[BUG] "git merge-file" mismerge
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 22, 2014, 19:19 UTC
- Message-ID
- <xmqqzjg1fbgm.fsf@gitster.dls.corp.google.com>
Consider these three files:
$ printf "%s\n" A B C D >ours
$ printf "%s\n" A C B D >common
$ printf "%s\n" A B D >theirsStarting from A C B D, our side flips the order of the second (C) and the third (B), while their side removes the second (C).
The correct three-way content level merge should notice conflict during this merge, but "git merge-file" that uses xdiff/xmerge.c, which is meant to be equivalent to "merge" from the RCS suite, declares that our version is already the correct merge result:
$ merge ours common theirs
merge: warning: conflicts during merge
$ cat ours
A
<<<<<<< ours
B
C
=======
B
>>>>>>> theirs
D
$ printf "%s\n" A B C D >ours ;# revert it back
$ git merge-file ours common theirs ; echo $?
0
$ cat ours
A
B
C
D