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

Re: Merging submodules - best merge-base

From
DBDaniel Bratell <bratell@opera.com>
Date
Mar 7, 2013, 09:49 UTC
Message-ID
<op.wtklj7e9rbppqq@cicero.linkoping.osa>
In-Reply-To
<20130306181156.GA4114@sandbox-ub>
Den 2013-03-06 19:12:05 skrev Heiko Voigt <hvoigt@hvoigt.net>:
Show 54 quoted lines
> On Mon, Feb 25, 2013 at 05:44:05PM +0100, Daniel Bratell wrote:
>> I can phrase this in two ways and I'll start with the short way:
>>
>> Why does a merge of a git submodule use as merge-base the commit that  
>> was
>> active in the merge-base of the parent repo, rather than the merge-base  
>> of
>> the two commits that are being merged?
>>
>> The long question is:
>>
>> A submodule change can be merged, but only if the merge is a
>> "fast-forward" which I think is a fair demand, but currently it checks  
>> if
>> it's a fast-forward from a commit that might not be very interesting
>> anymore.
>>
>> If two branches A and B split at a point when they used submodule commit
>> S1 (based on S), and both then switched to S2 (also based on S) and B  
>> then
>> switched to S21, then it's today not possible to merge B into A, despite
>> S21 being a descendant of S2 and you get a conflict and this warning:
>>
>> warning: Failed to merge submodule S (commits don't follow merge-base)
>>
>> (attempt at ASCII gfx:
>>
>> Submodule tree:
>>
>> S ---- S1
>>    \
>>     \ - S2 -- S21
>>
>> Main tree:
>>
>> A' (uses S1) --- A (uses S2)
>>    \
>>     \ --- B' (uses S2) -- B (uses S21)
>>
>>
>> I would like it to end up as:
>>
>> A' (uses S1) --- A (uses S2) ------------ A+ (uses S21)
>>    \                                     /
>>     \ --- B' (uses S2) -- B (uses S21)- /
>>
>> And that should be legal since S21 is a descendant of S2.
>
> So to summarize what you are requesting: You want a submodule merge be
> two way in the view of the superproject and calculate the merge base
> in the submodule from the two commits that are going to be merged?
>
> It currently sounds logical but I have to think about it further and
> whether that might break other use cases.

Maybe both could be legal even. The current code can't be all wrong, and this case also seems to be straightforward.

/Daniel
Previous: Heiko VoigtNext: Heiko Voigt
Message 3 of 7 in “Merging submodules - best merge-base”
  1. Daniel BratellFeb 25, 2013
  2. Heiko VoigtMar 6, 2013
  3. Daniel BratellMar 7, 2013
  4. Heiko VoigtMar 7, 2013
  5. Jens LehmannMar 9, 2013
  6. Heiko VoigtMar 10, 2013
  7. submodule: allow common rewind when merging submodulesHeiko Voigt, Mar 11, 2013

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.