git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas T.Auer" <andreas.t.auer_gtml_37453@ursus.ath.cx>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: Phil Hord <phil.hord@gmail.com>, git@vger.kernel.org
Subject: Re: Auto update submodules after merge and reset
Date: Tue, 13 Dec 2011 10:45:03 +0100	[thread overview]
Message-ID: <4EE71E9F.90204@ursus.ath.cx> (raw)
In-Reply-To: <4EE682A3.8070704@web.de>



On 12.12.2011 23:39 Jens Lehmann wrote:
>  Am 11.12.2011 22:15, schrieb Andreas T.Auer:
> >
> > 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.
>
>  Using superproject branch names in the submodules make no sense for a
>  lot of use cases.
The most useful workflows for some use cases make no sense for a lot of 
other use cases. That is why configuration options are useful, right? 
There is no one-size-fits-all. It surely won't make sense for 
independent submodules.

> > 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
>
>  Having that configured with "branch=unstable", "branch=stable" etc.
>  in .gitmodules on the superprojects branches would be simpler and
>  achieve the same functionality.

Yes, this has been my first thought also, but there is also a good point 
to keep the .gitmodules stable, or you always have to change the file 
when branches change their names. So when the maint branch of version 
1.3 become an archive branch and the new maint is on 1.4, which was the 
master before then you have to change the .gitmodules on these branches. 
I.e. .gitmodules of 1.4 have "stable" and must have "bugfixes" now and 
.gitmodules of 1.3 has "bugfixes" and must remove the floating 
completely. I'm not sure that this can always be solved with "easy" 
merging and therefore it is probably not really simpler, when you have 
to do this for every new release. Or what do you think?

> > 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.
>
>  I think checkout should only use the submodule commit recorded in the
>  superproject and a subsequent "git submodule update" should be needed
>  to update the submodule to tip. Otherwise you record SHA-1 but still
>  won't be able to bisect ...

bisect would leave the branch and therefore uses the recorded SHA1 for 
the submodule checkout instead of the tip. "follow-the-tip" should only 
work if the superproject follows the tip.
If you configure auto-update on checkout you would not expect that a 
separate git submodule update has a different behavior.

> > 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.
>
>  Nope, only when "git submodule update" is run. Otherwise you'll
>  spray the history with submodule updates totally unrelated to the
>  commits in the superproject, which is rather confusing.

Of course, committing a new version to the superproject should not 
trigger pulling in a new version for the submodule or an automatic jump 
to the tip of the submodule. I just meant a normal manual "commit -a" 
behavior. Putting a 0{40} hash in the gitlink or only the hash of the 
submodule, when it first was added would be a special treatment that is 
neither needed nor wanted.

  parent reply	other threads:[~2011-12-13  9:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30  0:55 Auto update submodules after merge and reset Max Krasnyansky
2011-11-30  8:31 ` Jens Lehmann
2011-12-06  1:06   ` Max Krasnyansky
2011-12-06 21:32     ` Jens Lehmann
2011-12-07  9:07   ` Andreas T.Auer
2011-12-07 22:23     ` Jens Lehmann
2011-12-08  9:13       ` andreas.t.auer_gtml_37453
2011-12-09 23:57         ` Phil Hord
2011-12-10  1:41           ` Andreas T.Auer
2011-12-11 14:43             ` Phil Hord
2011-12-11 21:15           ` Andreas T.Auer
2011-12-12 22:39             ` Jens Lehmann
2011-12-12 23:43               ` Phil Hord
2011-12-13  7:52                 ` Jens Lehmann
2011-12-13  9:45               ` Andreas T.Auer [this message]
2011-12-13 21:44                 ` Jens Lehmann
2011-12-13 23:05                   ` Andreas T.Auer
2011-12-14 15:16                     ` Marc Branchaud

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EE71E9F.90204@ursus.ath.cx \
    --to=andreas.t.auer_gtml_37453@ursus.ath.cx \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=phil.hord@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).