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

Re: SEGV in git-merge recursive:

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 31, 2007, 00:35 UTC
Message-ID
<Pine.LNX.4.64.0703301728510.6730@woody.linux-foundation.org>
In-Reply-To
<Pine.LNX.4.63.0703302239050.4045@wbgn013.biozentrum.uni-wuerzburg.de>
On Fri, 30 Mar 2007, Johannes Schindelin wrote:
Show 5 quoted lines
> 
> IMHO, there is actually no way merge_trees() can fix the conflicts enough 
> to write a tree.
> 
> So, the only way I see to avoid that SEGV is to something like this:
I disagree.
It's much better to give a bad intermediate tree than to give up entirely.
If you give up entirely, the merge is basically impossible to complete.

If you give a bad intermediate, the merge will just have potentially more-than-necessary conflicts in the end.

> +			die ("cannot continue merging.");

This really isn't acceptable. We're not monotone or one of those projects that thinks that merging is hard. Merging is *easy*.

We're looking for a base version for a merge - think of a three-way merge on a file level. And the easiest base version is actually an empty base file (or, when it comes to a rename conflict, no base names at all).

Sure, that will make all changes conflict, but that's a *hell* of a lot better than giving up. It just means that now the user has to figure out what the end result should be - exactly the same way that if you have an empty file as a base version, a three-way merge will basically generate a conflict marker that looks like

	<<<<
	one version of the file
	====
	the other version of the file
	>>>>

Rule #1 when merging should *always* be: "never leave the user high and dry". You don't give up and say "I can't merge this". You say "I couldn't merge this, but here's the mess I left for you to show me how it's done!"

		Linus
Previous: Johannes SchindelinNext: Linus Torvalds
Message 20 of 31 in “SEGV in git-merge recursive:”
  1. Tom PrinceMar 29, 2007
  2. Alex RiesenMar 29, 2007
  3. Tom PrinceMar 29, 2007
  4. Alex RiesenMar 29, 2007
  5. Tom PrinceMar 29, 2007
  6. Alex RiesenMar 29, 2007
  7. Tom PrinceMar 29, 2007
  8. Alex RiesenMar 29, 2007
  9. Alex RiesenMar 29, 2007
  10. Tom PrinceMar 29, 2007
  11. Alex RiesenMar 29, 2007
  12. Alex RiesenMar 29, 2007
  13. Alex RiesenMar 29, 2007
  14. An attempt to resolve a rename/rename conflict in recursive mergeAlex Riesen, Mar 29, 2007
  15. Alex RiesenMar 29, 2007
  16. Linus TorvaldsMar 29, 2007
  17. Linus TorvaldsMar 29, 2007
  18. Alex RiesenMar 29, 2007
  19. Johannes SchindelinMar 30, 2007
  20. Linus TorvaldsMar 31, 2007
  21. Linus TorvaldsMar 31, 2007
  22. Alex RiesenMar 31, 2007
  23. Keep rename/rename conflicts of intermediate merges while doing recursive mergeAlex Riesen, Mar 31, 2007
  24. Jakub NarebskiMar 31, 2007
  25. Johannes SchindelinMar 31, 2007
  26. Johannes SchindelinMar 31, 2007
  27. Linus TorvaldsMar 31, 2007
  28. Alex RiesenMar 31, 2007
  29. Junio C HamanoMar 31, 2007
  30. Johannes SchindelinMar 31, 2007
  31. Tom PrinceMar 29, 2007

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.