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

Re: Auto update submodules after merge and reset

From
ATAndreas T.Auer <andreas.t.auer_gtml_37453@ursus.ath.cx>
Date
Dec 11, 2011, 21:15 UTC
Message-ID
<4EE51D7B.7020806@ursus.ath.cx>
In-Reply-To
<CABURp0rcT2FR3uOmhyPUV5W3pu7WuJzjXktmUq0eb4nOiUwDKA@mail.gmail.com>
On 10.12.2011 00:57 Phil Hord wrote:
Show 8 quoted lines
>  On Thu, Dec 8, 2011 at 4:13 AM,
>  <andreas.t.auer_gtml_37453@ursus.ath.cx> wrote:
>
>  Yes, but maybe you can update this information in the .gitmodules
>  file easily with a command.  Maybe it could be something simpler
>  than "git sync-gitmodules-branches", but that is essentially what it
>  would do: it would save the current branch in each submodule as the
>  "tracked" branch in the .gitmodules file.

Ok, I have read a better description of the "floating submodule" model now, so it is a different use case and somehow it makes sense. In that case there are probably just a few branches that you would like to follow, maybe an "unstable" for the newest development or "stable" for the current release or some maintenance branches.

Show 9 quoted lines
>  Now this makes sense.  I want the same thing.  I want to preserve
>  history on "old" commits, but I want to "advance to tip" on "new"
>  commits.
>
>  The trouble, I think, is in telling the difference between "old" and
>   "new".  I think it means there is a switch, like --auto-follow (or
>  --no-auto-follow for the alternate if core.auto_follow is set).  But
>   having a config option as the default is likely to break lots of
>  scripts.

In my use case the branches on the submodules follow the superproject and (mostly) versions that are committed there, it just adds the possibility to keep on working without checking out a branch after an update and without colliding with existing branchnames in the submodule.

The other use case wants to follow the commits of that other submodule without checking the corresponding gitlinks into the superproject. But wouldn't it also make sense here to define actually a mapping in the .gitmodule that says "if the branch 'develop' is checkedout in the supermodule then with every submodule update automatically pull the newest 'unstable' commit from the submodule"? Or for "master" follow "stable" or for the "maint" branch follow updates in the "bugfixes" branch.

For example
[submodule "commonlib"]
     update = heads develop:unstable master:stable maint:bugfixes

So whenever a defined branch is checked out in the superproject the mapped branch will be checked out in the submodule ("new" commit), but if a (e.g. tagged) commit is checked out ("old" commit) then the gitlink in the superproject is used to check out the referenced commit in the submodule.

In http://thread.gmane.org/gmane.comp.version-control.git/183837 was discussed whether the gitlink in the superproject should be set to all-zero if updates follow the tip or maybe use the SHA1 of the commit when the submodule was added. I think the gitlink should be updated everytime when a new commit in the superproject is created.

Previous: Phil HordNext: Jens Lehmann
Message 11 of 18 in “Auto update submodules after merge and reset”
  1. Max KrasnyanskyNov 30, 2011
  2. Jens LehmannNov 30, 2011
  3. Max KrasnyanskyDec 6, 2011
  4. Jens LehmannDec 6, 2011
  5. Andreas T.AuerDec 7, 2011
  6. Jens LehmannDec 7, 2011
  7. andreas.t.auer_gtml_37453@ursus.ath.cxDec 8, 2011
  8. Phil HordDec 9, 2011
  9. Andreas T.AuerDec 10, 2011
  10. Phil HordDec 11, 2011
  11. Andreas T.AuerDec 11, 2011
  12. Jens LehmannDec 12, 2011
  13. Phil HordDec 12, 2011
  14. Jens LehmannDec 13, 2011
  15. Andreas T.AuerDec 13, 2011
  16. Jens LehmannDec 13, 2011
  17. Andreas T.AuerDec 13, 2011
  18. Marc BranchaudDec 14, 2011

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.