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

Wrong file diff for merge conflict

From
Stefan Bucur <stefan.bucur@gmail.com>
Date
Jul 4, 2009, 07:53 UTC
Message-ID
<loom.20090704T072854-229@post.gmane.org>
Hi!

I would like to point out a very strange behavior of git merge, which led to data loss or data duplication in the conflict file generated during a diff merge.

I had to merge two branches (A and B) which contained more files (e.g.
http://pastebin.ca/1483691 - before splitting branches) which were affected in
the following way:
* The files were formatted (indented) in branch A: http://pastebin.ca/1483684
* In branch B, their contents were altered in various points, but not
significantly (refactored some statements into macros): http://pastebin.ca/1483683

I checked out branch A, and I ran "git merge B", and (obviously) there was a conflict with this file. The big surprise was to see that the generated diff file looks like this:

http://pastebin.ca/1483228

The problem is with the last diff in the file, where the left portion is empty, and the right portion contains code which already was marked as merged (common), right before the start of the diff. Therefore, the mark at line 127 should really have been before line 114.

Is this a bug or I am missing something?

Thanks, Stefan Bucur

Next: Linus Torvalds
Message 1 of 7 in “Wrong file diff for merge conflict”
  1. Stefan BucurJul 4, 2009
  2. Linus TorvaldsJul 5, 2009
  3. Jakub NarebskiJul 5, 2009
  4. Junio C HamanoJul 5, 2009
  5. Stefan BucurJul 5, 2009
  6. Linus TorvaldsJul 6, 2009
  7. Stefan BucurJul 6, 2009

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.