Re: [PATCH] submodule.sh update --remote: default to oid instead of master
- Date: Thu, 6 Sep 2018 11:06:15 -0700
- From: Stefan Beller <sbeller@xxxxxxxxxx>
- Subject: Re: [PATCH] submodule.sh update --remote: default to oid instead of master
On Wed, Sep 5, 2018 at 4:10 PM Jonathan Nieder <jrnieder@xxxxxxxxx> wrote:
> Stefan Beller wrote:
> > Subject: submodule.sh update --remote: default to oid instead of master
> Nit: it wasn't clear to me at first what default this subject line was
> referring to. Perhaps:
> submodule update --remote: skip GITLINK update when no branch is set
> > --- a/Documentation/gitmodules.txt
> > +++ b/Documentation/gitmodules.txt
> > @@ -50,11 +50,12 @@ submodule.<name>.update::
> > submodule.<name>.branch::
> > + If the option is not specified, do not update to any branch but
> > + the object id of the remote.
> Likewise: how about something like
> If not set, the default is for `git submodule update --remote`
> to update the submodule to the superproject's recorded SHA-1.
... recorded object id.
> > + git add .gitmodules &&
> > + git commit --allow-empty -m "submodules: pin in superproject branch"
> > + ) &&
> I wonder if we can do simpler by using -C + some helpers: something like
> git config --unset -f super/.gitmodules ... &&
> test_commit -C submodule ... &&
> git -C super submodule update ... &&
> test_cmp_rev ...
> Unfortunately test_cmp_rev doesn't accept a -C argument.
and the lack of fortune goes further, as test_cmp_rev needs to have
2 revisions in the same repository, i.e. both need to exist,
which is not the case.
> Broader comment: do you think people will be surprised by this new
> behavior? Is there anything special we'd need to do to call it out
> (e.g., print a warning or put something in release notes)?
I guess. Not sure how to approach this best. Maybe we can
extend the output of 'submodule update' to print that branch names
instead of hashes for the configured case and keep printing hashes
only for this case. Although that would not help someone who relies
on the default solely.