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

Re: Automatic merge failed, fix up by hand

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Aug 24, 2005, 03:11 UTC
Message-ID
<Pine.LNX.4.63.0508232231110.23242@iabervon.org>
In-Reply-To
<7v3bp0m9ax.fsf@assigned-by-dhcp.cox.net>
On Tue, 23 Aug 2005, Junio C Hamano wrote:
Show 5 quoted lines
> Only lightly tested, in the sense that I did only this one case
> and nothing else.  For a large repository and with complex
> merges, "merge-base -a" _might_ end up reporting many
> candidates, in which case the pre-merge step to figure out the
> best merge base may turn out to be disastrously slow.  I dunno.

I think it's the right thing to do for now (and what I was going to suggest), and if people find it too slow, we can consider teaching read-tree to take multiple common ancestors and use any of them that gives clear result on a per-file basis.

On the other hand, Tony might have hit a bad case with an ill-chosen common ancestor for a patch/revert sequence, and we probably want to look into that if we've got some history that demonstrates the problem. I think that, if there are two common ancestors, one of which has applied a patch and one of which hasn't, and on one side of the merge it gets reverted, we should get the revert, but we'll only get it if we choose the ancestor where it was applied.

(Letters are versions of the file, which 'b' being the bad patch; the
 second column is the two choices for common ancestor)
  a-b-a-?
 / X   /
a-b-b-b

Of course, you could have the two lines exactly flipped for a different file in the same commits, or for a different hunk in the same file, and there would be no single choice that doesn't lose the revert. The really right thing to do is identify that there is a b->a transition that is not a trivial merge and that is not beyond a common ancestor, but that's hard to determine easily and with sufficient granularity to catch everything.

I still someday want to do a version of diff/merge for git that could select common ancestors on a per-hunk basis and identify block moves and avoid giving confusing (but marginally shorter) diffs, but that's a major undertaking that I don't have time for right now.

	-Daniel
*This .sig left intentionally blank*
Previous: Len BrownNext: Len Brown
Message 10 of 12 in “Automatic merge failed, fix up by hand”
  1. Len BrownAug 23, 2005
  2. Junio C HamanoAug 23, 2005
  3. Len BrownAug 23, 2005
  4. Junio C HamanoAug 23, 2005
  5. Junio C HamanoAug 24, 2005
  6. Junio C HamanoAug 24, 2005
  7. Linus TorvaldsAug 24, 2005
  8. Junio C HamanoAug 24, 2005
  9. Len BrownAug 24, 2005
  10. Daniel BarkalowAug 24, 2005
  11. Len BrownAug 24, 2005
  12. Linus TorvaldsAug 24, 2005

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.