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

Re: [PATCH] git-merge: Reduce heads before trying to merge them

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 17, 2012, 20:48 UTC
Message-ID
<7vvckym6ec.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CA+55aFzLFA535CtjLJe1p62H=nunQ=vrL_mPYsYJB0e8U7mpdg@mail.gmail.com>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 28 quoted lines
> 2012/4/17 Junio C Hamano <gitster@pobox.com>:
>>
>> If your current HEAD is an ancestor of one of the commit on that list, the
>> above does not omit it from the parent list of the resulting merge commit,
>> but if you performed the same merge while on one of the commit being
>> merged, your current HEAD will be excluded with reduce_heads(), which
>> would mean that you will end up recording a different history even though
>> a merge is supposed to be symmetrical.
>>
>> In other words, isn't any solution that calls reduce_heads() only on
>> remoteheads fundamentally wrong and merely papering over the problem?
>
> I think Michał's patch, together with my original one (but not the
> fixups later) is actually the right thing to do.
>
> Michał's patch fixes the "log shown multiple times" problem. It also
> turns a certain class of octopus merges into trivial common merges,
> which is good.
>
> So I'd suggest:
>  - undo the two top commits from lt/octopus-simplify
>  - apply Michał's patch on top of the remaining one commit
>
> It's not perfect, and I really think we could simplify things a bit
> more here, but I think the two commits together fix the problems in
> practice.
>
> Hmm?

I was cooking a fix on-and-off since yesterday evening, and sent it out a few minutes ago. I think the spirit is almost the same as Michał's updated patch, but it reduces the heads even earlier to catch cases where Michał's updated patch may misdiagnose arity of the resulting merge due to its use of remoteheads->next before the list is reduced (namely, the choice of the default strategy based on how many we are merging).

Previous: Linus TorvaldsNext: Michał Kiedrowicz
Message 19 of 22 in “Re: What's cooking in git.git (Apr 2012, #05; Thu, 12)”
  1. Michal KiedrowiczApr 16, 2012
  2. Linus TorvaldsApr 16, 2012
  3. Junio C HamanoApr 16, 2012
  4. Linus TorvaldsApr 16, 2012
  5. Junio C HamanoApr 16, 2012
  6. 0/4 merge: reduce set of parents consistentlyJunio C Hamano, Apr 17, 2012
  7. 1/4 git-merge: test octopus with redundant parentsJunio C Hamano, Apr 17, 2012
  8. 2/4 builtin/merge.c: remove "remoteheads" global variableJunio C Hamano, Apr 17, 2012
  9. 3/4 builtin/merge.c: collect other parents earlyJunio C Hamano, Apr 17, 2012
  10. 4/4 builtin/merge.c: reduce parents earlyJunio C Hamano, Apr 17, 2012
  11. Junio C HamanoApr 16, 2012
  12. Linus TorvaldsApr 16, 2012
  13. Linus TorvaldsApr 16, 2012
  14. Michał KiedrowiczApr 16, 2012
  15. Linus TorvaldsApr 17, 2012
  16. git-merge: Reduce heads before trying to merge themMichał Kiedrowicz, Apr 17, 2012
  17. Junio C HamanoApr 17, 2012
  18. Linus TorvaldsApr 17, 2012
  19. Junio C HamanoApr 17, 2012
  20. Michał KiedrowiczApr 18, 2012
  21. Junio C HamanoApr 18, 2012
  22. Junio C HamanoApr 19, 2012

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.