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

Re: [PATCH] submodule.sh update --remote: default to oid instead of master

From
Stefan Beller <sbeller@google.com>
Date
Sep 6, 2018, 18:06 UTC
Message-ID
<CAGZ79kY_O+y0=1qMr2tw2cw3ULhhjTPQ-G5swa+KNXKLKSOSYw@mail.gmail.com>
In-Reply-To
<20180905231006.GC120842@aiede.svl.corp.google.com>
On Wed, Sep 5, 2018 at 4:10 PM Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 26 quoted lines
>
> Stefan Beller wrote:
>
> > Subject: submodule.sh update --remote: default to oid instead of master
>
> Yay!
>
> 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.
sounds good.
Show 12 quoted lines
> > +             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.

Previous: Jonathan NiederNext: Jonathan Nieder
Message 3 of 5 in “submodule.sh update --remote: default to oid instead of master”
  1. submodule.sh update --remote: default to oid instead of masterStefan Beller, Sep 5, 2018
  2. Jonathan NiederSep 5, 2018
  3. Stefan BellerSep 6, 2018
  4. Jonathan NiederSep 6, 2018
  5. submodule update --remote: introduce pinningStefan Beller, Oct 2, 2018

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.