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

Re: git submodules and commit

From
Nigel Magnay <nigel.magnay@gmail.com>
Date
Jul 16, 2008, 12:48 UTC
Message-ID
<320075ff0807160548qae5d702jafe3df63363c512c@mail.gmail.com>
In-Reply-To
<487DDCFC.9020007@viscovery.net>
Show 15 quoted lines
> Ah, is this your actual scenario? Just to make sure we are talking about
> the same thing:
>
> - You own superproject P.
> - $Maintainer owns submodule S.
> - You use S in P.
> - You make changes to S that you would like $Maintainer to include in the
> next release.
> x You use in P your changes to S while $Maintainer has not yet released a
> new version of S with your changes.
> - Finally your changes arrive via the new release of S.
>
> That *is* the intended use-case for submodules. But you have to play the
> game by the rules:
>

Yes, that is the situation - with the proviso that it's not always clear in company environments who $Maintainer actually is. For example, if the only changes occurring in S come from me, then chances are come release cycle, $Maintainer == me.

P and S aren't distant projects, they're closely coupled.
> - $Maintainer defines the official states of S.
>

Yes - there is one branch ('master') which the changes eventually should be merged to, and releases will be performed on

> - You must never commit an unofficial state of S in P.
>

If by that you mean that the only person to move the branch 'master' is $Maintainer, then I agree. If by that you mean that you can't commit at all to the S tree (and the S submodule pointer) then I don't agree, and I think that's a serious limitation in productivity.

Show 8 quoted lines
> The critical step in above list I marked with x:
>
> - During the period where only *you* have the new changes to S, you must
> *not* commit your submodule state to P. Instead, you write P in such a way
> that it can work with both the old version of S and the upcoming release
> that will have your changes[*]. This way you make sure that your consumers
> of P always have a working version regardless of which version of S they use.
>

Just to be clear - there's more than just 'me' working on P - there's a whole team of people working on it. And there's Q R S and T teams also working on projects that also have S.

Changes that happen to S are, often, new features or bug fixes. We can't just stop because there isn't an 'official' version of S yet (and the official version might end up simply being a FF anyway), so saying 'don't commit your submodule state to P' is unrealistic.

And that should be the big advantage of git. If we suddenly find we need some additional functionality in S, we just add it to our P-branch-of-S. The $Maintainer (if he exists) can review these upcoming changes in the tree, and merge them to master as appropriate (or work with the projects to iron out cross-branch incompatibilities). The best example is that S is a "product", and (by management decree), the only product changes that happen will occur because of *projects* (like P). And we can do this (and it's infinitely better than svn, where 'ooh, branches too hard, everyone in [P-T] just commit to trunk'. But the UI is an ache.

Show 6 quoted lines
> - After you have received the new release of S from $Maintainer, you
> commit the new state of S in P. And if you are nice to your consumers of
> P, then you *do not* remove the workaround from P just yet, so that you
> don't force them to upgrade S. You will remove it later only if it becomes
> a maintainance burden.
>
Maintaining backwards compatibility isn't an issue at all for us.
Show 7 quoted lines
> [*] If it is not possible to make P work with old and new versions, then
> you have to work closely with the $Maintainer so that you never need
> commit an unofficial state of S into P.
>
> -- Hannes
>
>
Previous: Petr BaudisNext: Johannes Sixt
Message 6 of 14 in “git submodules and commit”
  1. Nigel MagnayJul 16, 2008
  2. Johannes SixtJul 16, 2008
  3. Nigel MagnayJul 16, 2008
  4. Johannes SixtJul 16, 2008
  5. Petr BaudisJul 16, 2008
  6. Nigel MagnayJul 16, 2008
  7. Johannes SixtJul 16, 2008
  8. Nigel MagnayJul 16, 2008
  9. Petr BaudisJul 16, 2008
  10. Nigel MagnayJul 16, 2008
  11. Avery PennarunJul 16, 2008
  12. Nigel MagnayJul 17, 2008
  13. Avery PennarunJul 17, 2008
  14. Ping YinJul 18, 2008

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.