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

[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 >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
    >>>>>>> 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
    
    
Message 1 of 1 in “[BUG] "git merge-file" mismerge”
  1. Junio C HamanoJul 22, 2014

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.