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

Re: [PATCH] Fix segfault in merge-recursive

From
Junio C Hamano <gitster@pobox.com>
Date
May 9, 2009, 16:54 UTC
Message-ID
<7vzldm6wu1.fsf@alter.siamese.dyndns.org>
In-Reply-To
<alpine.DEB.2.00.0905081624230.30999@narbuckle.genericorp.net>
Dave O <cxreg@pobox.com> writes:
> Once again, I don't really know what the implications of the index
> operations that are happening here are, but the update_stages() call
> in a recursive merge must be doing surprising.

When you are trying to come up with the final result (i.e. depth=0), you want to record how the conflict arose by registering the state of the common ancestor, your branch and the other branch in the index, hence you want to do update_stages().

When you are merging with positive depth, that is because of a criss-cross merge situation. In such a case, you would need to record the tentative result, with conflict markers and all as if the merge went cleanly, even if there are conflicts, in order to write it out as a tree object later to be used as a common ancestor tree. update_file() calls update_file_flags() with update_cache=1 to signal that the result needs to be written to the index at stage #0 (i.e. merged), and the code should not clobber the index further by calling update_stages().

Your patch looks correct.  Thanks.
Previous: Johannes SchindelinNext: Junio C Hamano
Message 10 of 13 in “Segfault during merge”
  1. Dave OMay 7, 2009
  2. Johannes SchindelinMay 7, 2009
  3. Dave OMay 8, 2009
  4. Fix segfault in merge-recursiveJohannes Schindelin, May 8, 2009
  5. Dave OMay 8, 2009
  6. Johannes SchindelinMay 8, 2009
  7. Dave OMay 8, 2009
  8. Don't update index while recursing (was Re: Segfault during merge)Dave O, May 9, 2009
  9. Johannes SchindelinMay 9, 2009
  10. Junio C HamanoMay 9, 2009
  11. Junio C HamanoMay 8, 2009
  12. Johannes SchindelinMay 9, 2009
  13. Jakub NarebskiMay 7, 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.