m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

git-merge-changelog


From: Eric Blake
Subject: git-merge-changelog
Date: Mon, 11 Feb 2008 18:13:26 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Bruno recently posted a useful git merge driver for ChangeLog files: 
http://lists.gnu.org/archive/html/bug-gnulib/2008-02/msg00033.html

I tested it out some today, and liked it enough to install this patch (listed 
here against the branch, but a similar one for head).  It makes merging 
distinct ChangeLog entries on different development branches much saner than 
the default merge algorithm of git (ie. much less likely to introduce conflict 
markers, and when there ARE conflict markers, they are over saner chunks of the 
file).  I also tested that git will properly report merge conflicts if you 
haven't installed git-merge-changelog or haven't set up .git/config 
appropriately to use it, although it no longer attempts the 3-way merge and the 
resulting file is left without conflict markers (IMO, still a better approach 
than the screwy conflict markers left behind when git _did_ attempt a 3-way 
merge).

From: Eric Blake <address@hidden>
Date: Mon, 11 Feb 2008 08:32:35 -0700
Subject: [PATCH] Use gnulib's git-merge-changelog driver when available.

* .gitattributes: New file.
* bootstrap: Install driver, if not already present.

Signed-off-by: Eric Blake <address@hidden>
---
 .gitattributes |    1 +
 ChangeLog      |    8 +++++++-
 bootstrap      |   17 +++++++++++++++--
 3 files changed, 23 insertions(+), 3 deletions(-)
 create mode 100644 .gitattributes

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..e8495d5
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+ChangeLog merge=merge-changelog
diff --git a/ChangeLog b/ChangeLog
index 8d76e5e..c69e3d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-11  Eric Blake  <address@hidden>
+
+       Use gnulib's git-merge-changelog driver when available.
+       * .gitattributes: New file.
+       * bootstrap: Install driver, if not already present.
+
 2008-02-06  Eric Blake  <address@hidden>
 
        Fix security hole introduced 2007-11-22.
@@ -18,7 +24,7 @@
        argument of a $@ at a time; but the penalties of this patch make
        it easier to manage $@ efficiently in future patches.
        Memory impact: noticeable penalty, due to larger struct and O(n)
-       to O(n^2) on unboxed recursion
+       to O(n^2) on unboxed recursion.
        Speed impact: noticeable penalty, due to more bookkeeping.
        * src/m4.h (struct token_chain): Add comma and quotes fields.
        (arg_adjust_refcount, arg_print, push_arg_quote): New prototypes.
diff --git a/bootstrap b/bootstrap
index 686434c..dec9499 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,9 +1,9 @@
 #! /bin/sh
 
-# bootstrap (GNU M4) version 2007-11-05
+# bootstrap (GNU M4) version 2008-02-11
 # Written by Gary V. Vaughan  <address@hidden>
 
-# Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 # This file is part of GNU M4.
 #
@@ -230,6 +230,19 @@ EOF
   cp $config_macro_dir/.cvsignore $config_macro_dir/.gitignore
 fi
 
+# See if we can use gnulib's git-merge-changelog merge driver.
+if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
+  if git config merge.merge-changelog.driver >/dev/null ; then
+    :
+  elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
+    func_echo "initializing git-merge-changelog driver"
+    git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
+    git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
+  else
+    func_echo "consider installing git-merge-changelog from gnulib"
+  fi
+fi
+
 ## ---------------------------- ##
 ## Find the gnulib module tree. ##
 ## ---------------------------- ##
-- 
1.5.4







reply via email to

[Prev in Thread] Current Thread [Next in Thread]