* Checking the merge conflicts
@ 2008-03-11 0:31 Santi Béjar
0 siblings, 0 replies; only message in thread
From: Santi Béjar @ 2008-03-11 0:31 UTC (permalink / raw)
To: Git Mailing List
Hi *,
sometimes I want to check how a conflicting merge was performed.
"git diff --cc" is not exactly what I want because it suppress a hunk
when the merge is equal to one of the parents (at the file and hunk
level). But I want to know which one was chosen. So I've made this
simple shell. Yes, it is ugly and all but does what I want.
[git-checkmerge]
#!/bin/sh
merge=${1:-HEAD}
branch1=$(git rev-parse $merge^1) || exit
branch2=$(git rev-parse $merge^2) || exit
tmpdir=$(mktemp -t -d git-checkmerge.XXXXXXXXX)
newrepo=$tmpdir/checkmerge
git clone -s $PWD $newrepo
cd $newrepo
git config user.name checkmerge
git config user.email checkmerge@checkmerge
git checkout $branch1
git merge $branch2
git diff -R $merge
I recreates the merge with conflict marks included, and shows the diff
between the "recreated merge" and the "merge".
For example with:
$ git-checkmerge 83a2cbbd5873afd99c6cfa01296532ed9a19bdac
[noisy output]
diff --git a/Makefile b/Makefile
index d2fefa1..bd0d05f 100644
--- a/Makefile
+++ b/Makefile
@@ -304,12 +304,7 @@ LIB_H = \
run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \
utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h \
-<<<<<<< HEAD:Makefile
mailmap.h remote.h parse-options.h transport.h diffcore.h
hash.h ll-merge.h fsck.h pack-revindex.h
-=======
- mailmap.h remote.h parse-options.h transport.h diffcore.h
hash.h fsck.h \
- pack-revindex.h
->>>>>>> 34cd62eb91600109378c8121c1fecd924a9af177:Makefile
DIFF_OBJS = \
diff.o diff-lib.o diffcore-break.o diffcore-order.o \
@@ -333,11 +328,7 @@ LIB_OBJS = \
color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \
convert.o attr.o decorate.o progress.o mailmap.o symlinks.o remote.o \
transport.o bundle.o walker.o parse-options.o ws.o archive.o branch.o \
-<<<<<<< HEAD:Makefile
ll-merge.o alias.o fsck.o pack-revindex.o
-=======
- alias.o fsck.o pack-revindex.o
->>>>>>> 34cd62eb91600109378c8121c1fecd924a9af177:Makefile
BUILTIN_OBJS = \
builtin-add.o \
(sorry if it get refilled/truncated)
you can see that in both conflicting hunks the first change was chosen.
It does all what I want (although slowly, does not support different
strategies,...),
but if there is interest ...
Santi
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-03-11 0:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-11 0:31 Checking the merge conflicts Santi Béjar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).