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

Re: RFC: Making submodules "track" branches

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 8, 2010, 16:09 UTC
Message-ID
<AANLkTimtWrp1yimeooJ-ptAaDoxwpUc5KOP9HJUxx0X2@mail.gmail.com>
In-Reply-To
<4C0E630A.7020803@xiplink.com>
On Tue, Jun 8, 2010 at 15:34, Marc Branchaud <marcnarc@xiplink.com> wrote:
Show 32 quoted lines
> On 10-06-08 03:12 AM, Johan Herland wrote:
>>
>> There are probably more issues that escape me now...
>
> Thanks for bringing this up!  I'm also very interested in this topic.
>
> The main issue I see is that I don't always want my submodules to track (or
> not track) a branch.  What I want changes depending on the circumstances.
>
> One aspect I really like about submodules is the ease of tagging.  I can tag
> the super-repo, and know that whenever I checkout that tag I'll always get
> the corresponding versions of the submodules as they were when the tag was
> made.  It would actually be disastrous, at least in my case, if the
> submodules were at the latest HEAD of some branch instead.
>
> This goes for almost any commit in the super-repo's history, not just the
> tagged ones:  Whenever I checkout a historical committish, I want to get the
> submodules as they were when that commit was made.  Even if I'm working at
> the HEAD of some branch, often that branch is based on a historical commit
> and I want to use the submodules as they were when that historical commit was
> made.
>
> All that said, I do think submodule branch tracking is useful.  Quite often a
> development topic will change the super-repo and one or more submodules.  It
> would be extremely helpful to do that work in a branch that spans the
> super-repo and (a subset of) the submodules.  (In my mind this capability is
> one of the main benefits Google's "repo" tool has over submodules.)
>
> So, back to the issue at hand: Sometimes I want static (non-tracking)
> submodules, and sometimes I want dynamic (tracking) submodules.  IMO, this
> makes Ævar's proposed configuration-based approach impractical.  (Of course,
> I'm not looking to replicate svn's externals...)

I'm proposing that you be able to configure how you want to handle submodules on a per-submodule basis.

The exact semantics that I proposed may be impractical for some reason, but the idea is that it'd be opt in. We'd perhaps have multiple approaches (via config) to submodules, instead of the current monolithic scheme.

So if you didn't want a svn:externals like "always track trunk" repository you'd just not set your superproject up to treat the submodule like that.

Show 12 quoted lines
> I'm not sure what the right approach is, but I have some thoughts:
>
>  - Maybe "git branch" should be able to create submodule-spanning branches.
>
>  - If so, then checkout, merge, pull and other branch-related commands should
> honor submodule-spanning branches.  "checkout" in particular needs to
> distinguish between when it's checking out an actual branch vs. some other
> committish, and if the branch being checked out is submodule-spanning it
> should checkout the latest HEAD of that branch for the submodules as well.
>
>  - It *may* be good enough to assume that matching branch names in the
> super-repo and the submodules are in fact submodule-spanning branches.

That won't work for submodules that you don't control. I have a repository that includes a lot of foreign code, they have a lot of different names for their "main branch" between them. So it needs to be configurable in the superproject.

Show 7 quoted lines
>  - Automating all this is tricky.  In my super-repo I almost never want to
> checkout the master HEAD of all my submodules.  In fact, many of my
> submodules are big (e.g. they're different Linux kernels), and are only
> needed when building particular things, so that checking all of them out at
> once is almost always a huge waste of time.
>
> All this is probably not the kind of feedback you were hoping for!  :)
Previous: Marc BranchaudNext: Marc Branchaud
Message 4 of 21 in “RFC: Making submodules "track" branches”
  1. Ævar Arnfjörð BjarmasonJun 7, 2010
  2. Johan HerlandJun 8, 2010
  3. Marc BranchaudJun 8, 2010
  4. Ævar Arnfjörð BjarmasonJun 8, 2010
  5. Marc BranchaudJun 8, 2010
  6. Ævar Arnfjörð BjarmasonJun 8, 2010
  7. Marc BranchaudJun 9, 2010
  8. Jens LehmannJun 8, 2010
  9. Johan HerlandJun 8, 2010
  10. Jens LehmannJun 9, 2010
  11. Johan HerlandJun 9, 2010
  12. Steven MichalskeJun 9, 2010
  13. Johan HerlandJun 9, 2010
  14. Junio C HamanoJun 8, 2010
  15. Ævar Arnfjörð BjarmasonJun 8, 2010
  16. Jens LehmannJun 9, 2010
  17. Jens LehmannJun 9, 2010
  18. Marc BranchaudJun 9, 2010
  19. Ævar Arnfjörð BjarmasonJun 9, 2010
  20. nottrobinNov 20, 2012
  21. W. Trevor KingNov 20, 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.