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

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

From
Glen Choo <chooglen@google.com>
Date
Nov 11, 2021, 18:12 UTC
Message-ID
<kl6lbl2qv9wq.fsf@chooglen-macbookpro.roam.corp.google.com>
In-Reply-To
<000a01d7d671$1c7d4820$5577d860$@nexbridge.com>
<rsbecker@nexbridge.com> writes:
Show 10 quoted lines
>> > 4. If working on the submodule, use a branch, not a commit - typically off
>> main.
>> 
>> With the proposed UX, step (4) would happen automatically when using
>> "branch --recurse-submodules". Users would get a safer and more
>> convenient default.
>
> I think this might be more reliably done using a switch in .gitconfig to enable the capabilities. Perhaps something like:
>
> submodule.fetch-branches=true

Correct me if I am wrong, but we might be suggesting different things here. "submodule.fetch-branches" suggests to me that you're thinking of submodule branches that track the remotes of the submodule. The proposed UX is more about how we have submodule branches that work in tandem with superproject branches.

A user who is only concerned about a single submodule can cd and make their changes as if the submodule were a standalone repo - I think that's pretty well-supported. The missing link being able to coordinate this work with the superproject.

Show 12 quoted lines
>> > What I could see as a possible improvement is to add the branch ref to the
>> submodule ref file - not replacing the commit but adding to it. I do worry that
>> there are unintended (unforeseen) side-effects that will result from this,
>> however, including potential merge conflicts. Two people working on the
>> same commit but different branches may mess the ref file, so not really a
>> good idea.
>> 
>> It's an interesting idea, but as you noted, it is quite thorny. I would also like to
>> see more information being captured by the superproject tree (instead of
>> just .gitmodules), but I'm also not sure how we might do that.
>
> I'm suggesting this instead of a command-line option because this seems more like a policy-based process that you would either always want or never want. I would not like to depend on a developer making the call each time a clone occurred. I'm sad to admit that I don't really know where to start on this enhancement, though, even if approved.

Agreed with regards to both points, i.e. using a config instead of CLI option, and not knowing where to start..

Previous: rsbecker@nexbridge.comNext: Philippe Blain
Message 6 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.