git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC] Introduce git-xxdiff to invoke xxdiff for manual conflict resolution

From
MLMartin Langhoff <martin@catalyst.net.nz>
Date
Aug 3, 2006, 23:53 UTC
Message-ID
<11546492331601-git-send-email-martin@catalyst.net.nz>

This is a bit of a crude but really useful shortcut for conflict resolution. The name is bad, but git-merge-* is a different 'namespace', and git-resolve is also taken.

And as different conflict resolvers take different options, it may make sense to have git-xxdiff, git-sdiff and git-winmerge at least initially.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
---
 Makefile      |    2 +-
 git-xxdiff.sh |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 8349e3d..a6f6628 100644
--- a/Makefile
+++ b/Makefile
@@ -145,7 +145,7 @@ SCRIPT_SH = \
 	git-applymbox.sh git-applypatch.sh git-am.sh \
 	git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
 	git-merge-resolve.sh git-merge-ours.sh \
-	git-lost-found.sh git-quiltimport.sh
+	git-lost-found.sh git-quiltimport.sh git-xxdiff.sh
 
 SCRIPT_PERL = \
 	git-archimport.perl git-cvsimport.perl git-relink.perl \
diff --git a/git-xxdiff.sh b/git-xxdiff.sh
new file mode 100755
index 0000000..d562ab2
--- /dev/null
+++ b/git-xxdiff.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+USAGE='<path>'
+SUBDIRECTORY_OK=No
+. git-sh-setup
+
+FILE=$1
+MERGE_HEAD=`git rev-parse MERGE_HEAD`
+
+# Sanity checks
+if test ! -n "$FILE"
+then
+	echo Need a path
+	exit 1
+fi
+
+if test ! -n "$MERGE_HEAD"
+then
+	echo git-xxdiff is only useful during a merge
+fi
+
+git cat-file blob HEAD:$FILE > $FILE~HEAD
+if test $? -gt 0
+then 
+	echo "Error - maybe $FILE is not tracked by git?"
+	exit
+fi
+echo Written $FILE~HEAD
+
+git cat-file blob $MERGE_HEAD:$FILE > $FILE~MERGE_HEAD
+if  test $? -gt 0
+then 
+	echo "Error - maybe $FILE is not tracked by git?"
+	exit
+fi
+echo Written $FILE~MERGE_HEAD
+
+xxdiff -wbB --show-merged-pane --merged-filename $FILE~merged $FILE~HEAD $FILE~MERGE_HEAD
\ No newline at end of file
-- 
1.4.2.rc2.g1869bc-dirty
Next: Junio C Hamano
Message 1 of 9 in “[RFC] Introduce git-xxdiff to invoke xxdiff for manual conflict resolution”
  1. Martin LanghoffAug 3, 2006
  2. Junio C HamanoAug 4, 2006
  3. Martin Langhoff (CatalystIT)Aug 4, 2006
  4. [RFC] Introduce git-xxdiff to invoke xxdiff for manual conflict resolution - take 2Martin Langhoff, Aug 4, 2006
  5. Alex RiesenAug 4, 2006
  6. Martin LanghoffAug 5, 2006
  7. Martin Langhoff (CatalystIT)Aug 4, 2006
  8. Jeff KingAug 4, 2006
  9. Martin Langhoff (CatalystIT)Aug 4, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.