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

Re: [RFC] Branches with --recurse-submodules

From
Philippe Blain <levraiphilippeblain@gmail.com>
Date
Nov 12, 2021, 03:22 UTC
Message-ID
<f88923bc-4a3d-e6e8-2c04-d75bef8a35d9@gmail.com>
In-Reply-To
<kl6lh7cjvpm3.fsf@chooglen-macbookpro.roam.corp.google.com>
Hi Glen,
Le 2021-11-10 à 13:21, Glen Choo a écrit :
Show 37 quoted lines
> 
> I found some points that I should have given more attention to in the
> RFC. I'd appreciate any and all feedback :)
> 
> Glen Choo <chooglen@google.com> writes:
> 
>> In a superproject-submodule relationship there is some ambiguity in what
>> ‘checkout the branch `topic`’ should mean (does the submodule use its
>> topic branch, or the version recorded in the superproject’s gitlink?).
>> Our approach is to preserve existing semantics where reasonable - the
>> ref name refers to the superproject’s ref, just as it does without
>> --recurse-submodules.
> 
> Because a gitlink only contains a commit id, the submodule branch will
> use a plain commit id as the branch point. This gives the correct ref,
> but it gives no hints as to what the submodule branch should track.
> 
> The current thought process is to set up tracking using the ref name and
> the submodule's config. Thus, a more complete description of
> 
>    git branch --recurse-submodules topic origin/main
> 
> is something like:
> 
> * for each repository, create the 'topic' branch where each 'topic'
>    branch points to the version recorded in the superproject's
>    'origin/main'
> * for each repository, setup tracking for the 'topic' branch using the
>    repository's own 'origin/main' as the branch point
> 
> Note that there is no guarantee that a submodule's 'origin/main' points
> to the same commit as the superproject's 'origin/main', or if the
> submodule's 'origin/main' even exists.
> 
> If tracking information cannot be setup, we will still create the
> branch; we will only warn users when they run a command that requires
> tracking information e.g. fetch or push.

OK. That makes sense. Another option could be to track the branch pointed to by origin/HEAD in the submodule (in an ideal world, that would point to the default branch, but that has to be done mostly manually as of today...)

Previous: Glen ChooNext: Philippe Blain
Message 7 of 11 in “[RFC] Branches with --recurse-submodules”
  1. Glen ChooNov 8, 2021
  2. Glen ChooNov 10, 2021
  3. rsbecker@nexbridge.comNov 10, 2021
  4. Glen ChooNov 10, 2021
  5. rsbecker@nexbridge.comNov 10, 2021
  6. Glen ChooNov 11, 2021
  7. Philippe BlainNov 12, 2021
  8. Philippe BlainNov 12, 2021
  9. Glen ChooNov 15, 2021
  10. Philippe BlainNov 23, 2021
  11. Glen ChooNov 23, 2021

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.