Skip to contentSkip to conversation

"git merge-file" mismerge

BUG Junio C Hamano 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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 >theirs

Starting 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
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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