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

Re: git submodule update --merge (Was: What's cooking in git.git (May 2009, #02; Sun, 17))

From
Johan Herland <johan@herland.net>
Date
May 19, 2009, 13:26 UTC
Message-ID
<200905191526.40471.johan@herland.net>
In-Reply-To
<alpine.DEB.1.00.0905191348460.4266@intel-tinevez-2-302>
On Tuesday 19 May 2009, Johannes Schindelin wrote:
Show 24 quoted lines
> On Tue, 19 May 2009, Johan Herland wrote:
> > On Tuesday 19 May 2009, Johannes Schindelin wrote:
> > > On Tue, 19 May 2009, Johan Herland wrote:
> > > > [git submodule update --merge]
> > >
> > > We have a _lot_ of obscure things that are not supported by core
> > > Git, but are _very_ easy to add as _tiny_ add-on scripts by the
> > > user, without the need for "official" feature support.
> > >
> > > Just like this one
> >
> > Does that mean you're also opposed to 'git submodule update
> > --rebase' (which is already in 'next', and is even Signed-off-by
> > yourself)?
>
> No, because -- as I said myself already a couple of times -- I can
> see this supporting a common workflow.
>
> > I still don't see any reason why one should be added (--rebase),
> > and not the other (--merge).
>
> When you rebase, you see your personal stuff (i.e. stuff that you do
> not want to submit, or not in its current form, or that you submitted
> and it waits for inclusion) on top of things right away.

But if there are developers downstream whose work is based on your submodule branch, the rebase will disrupt _their_ work, in the same way that rebasing any other public branch would disrupt people's work.

> In contrast, if you merge, you will have a different state from the
> upstream _forever_.  Even if your stuff gets included.

Correct, but there are cases where reconciliation with the upstream repo is less important than not disrupting downstream developers (see below).

> Needless to say, I do not see much use for the latter case, but tons
> for the former.

I fully agree that for a regular downstream (or "leaf") developer, there is not much use for git submodule rebase --merge.

But not all developers fit nicely into your scenario above. Please consider the following scenario (loosely based on the setup at my $dayjob):

1. There is a collection of "core" repositories that provide common 
platform-independent functionality that is useful to several projects.
2. There is a group of "core" developers that work directly on 
the "core" repos in #1. These developers are not much concerned with 
submodule functionality at all.
3. There are multiple projects that each have their own project 
super-repo, which contains a set of submodules. Most of these 
submodules are clones of the "core" repos in #1.
4. Each project has a group of developers that work on that project. 
These developers clone the project super-repo in #3, and do their work, 
both directly in the super-repo, and within the submodules. Their 
changes (both in the super-repo and its submodules), are pushed back 
into the shared project repos (i.e. the project super-repo, and the 
project's clones of the "core" repos). The project developers will 
typically use "git submodule update --rebase" to keep their own 
unfinished changes on top of submodule updates.
5. Finally, there is the last group of developers, in between the two 
other groups - call them "branch managers" or "integration developers". 
These developers are responsible for synchronizing the work done by the 
downstream project developers (#4) and the work done by the 
upstream "core" developers (#2):

a) Some of the changes done by the project developers are useful to _all_ projects using that "core" module, and are sent as patches to the "core" developers for inclusion upstream.

b) Some changes are NOT useful to the upstream project, and are kept on the project-specific branch of the submodule.

Now, consider what happens when a new version of a "core" module (#1) is released/published: The new version contains general improvements to that module, and all projects that use the module should upgrade to the new version. The integration developers (#5) for a given project is responsible for this upgrade. How are they going to do the upgrade without disrupting the work of the project developers (#4)?

- They obviously cannot use the default "git submodule update", since 
that would lose all project-specific changes (see b), and it would also 
disrupt the downstream project developers.
- Using "git submodule update --rebase" is certainly better (they don't 
lose the project-specific changes), but they still rebase the project 
branch (which disrupts the downstream project developers).

Therefore, the straightforward solution is to merge the new upstream version into the existing project branch. This preserves the project-specific changes, AND it does not disrupt the downstream developers.

Hence, support for "git submodule update --merge" is a very welcome feature for these integration developers.

I understand that the above scenario is not common in the free software world, but I believe it is much more common in an enterprise/company setting. Therefore, the support of such workflows is important to companies that are currently considering (or have already chosen) Git. I believe there is value in supporting such workflows, especially when doing so is as straightforward as my patch shows.

Thanks for your attention,
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Johannes SchindelinNext: Johan Herland
Message 15 of 23 in “What's cooking in git.git (May 2009, #02; Sun, 17)”
  1. Junio C HamanoMay 17, 2009
  2. Jakub NarebskiMay 17, 2009
  3. Junio C HamanoMay 17, 2009
  4. Jakub NarebskiMay 17, 2009
  5. David AguilarMay 17, 2009
  6. Johan HerlandMay 18, 2009
  7. Markus HeidelbergMay 18, 2009
  8. Johan HerlandMay 18, 2009
  9. git-submodule: add support for --merge.Johan Herland, May 19, 2009
  10. Junio C HamanoMay 19, 2009
  11. Johan HerlandMay 19, 2009
  12. Johannes SchindelinMay 19, 2009
  13. Johan HerlandMay 19, 2009
  14. Johannes SchindelinMay 19, 2009
  15. Johan HerlandMay 19, 2009
  16. Johan HerlandMay 25, 2009
  17. Junio C HamanoMay 25, 2009
  18. Johannes SchindelinMay 25, 2009
  19. Avery PennarunMay 25, 2009
  20. Johannes SchindelinMay 25, 2009
  21. Johan HerlandMay 25, 2009
  22. Johan HerlandMay 25, 2009
  23. Peter HuttererMay 25, 2009

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.