path: root/builtin/merge-file.c
diff options
authorJonathan Nieder <>2010-03-21 00:37:33 (GMT)
committerJunio C Hamano <>2010-03-21 03:36:11 (GMT)
commit4bb0936206b046a4fe606e9b0c9fe6ecc7a0ff69 (patch)
tree9559a761fb84a790fd35f5ee494984a405e8bebc /builtin/merge-file.c
parenta4b5e91c49238146f4cb85ff5f7f3bc97e0e51de (diff)
merge-file --diff3: add a label for ancestor
git merge-file --diff3 can be used to present conflicts hunks including text from the common ancestor. The added information is helpful for resolving a merge by hand, and merge tools can usually grok it because it looks like output from diff3 -m. However, ‘diff3’ includes a label for the merge base on the ||||||| line and some tools cannot parse conflict hunks without such a label. Write the base-name as passed in a -L option (or the name of the ancestor file by default) on that line. git rerere will not have trouble parsing this output, since instead of looking for a newline, it looks for whitespace after the ||||||| marker. Since rerere includes its own code for recreating conflict hunks, conflict identifiers are unaffected. No other code in git tries to parse conflict hunks. Requested-by: Stefan Monnier <> Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/merge-file.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/merge-file.c b/builtin/merge-file.c
index 65eb790..610849a 100644
--- a/builtin/merge-file.c
+++ b/builtin/merge-file.c
@@ -77,6 +77,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
+ xmp.ancestor = names[1];
xmp.file1 = names[0];
xmp.file2 = names[2];
ret = xdl_merge(mmfs + 1, mmfs + 0, mmfs + 2, &xmp, &result);