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
Jonathan Nieder <jrnieder@gmail.com>
Date
Sep 6, 2018, 22:54 UTC
Message-ID
<20180906225423.GB81412@aiede.svl.corp.google.com>
In-Reply-To
<CAGZ79kY_O+y0=1qMr2tw2cw3ULhhjTPQ-G5swa+KNXKLKSOSYw@mail.gmail.com>
Stefan Beller wrote:
> On Wed, Sep 5, 2018 at 4:10 PM Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 9 quoted lines
>> 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.

Thinking more out loud: often the simplest migration path involves multiple steps:

 1. Warn in the case that is going to change, with no behavior change
    yet.
 2. Treat the case that will change as an error.  This should
    help flush out cases where people were relying on the old behavior.
 3. Introduce the new behavior.  Warn that old versions of Git don't
    support it yet.
 4. Eliminate the warning.  You're all clear now.
Sometimes some of these steps can be combined.

Another possible approach is to measure. For example, is there some way to find out how many people are relying in this "git submodule update --remote" defaulting behavior? One example of this approach is to make the change (all in one step) in "next" and deploy to some relevant subpopulation and see if anyone screams. By making the change in "next" instead of something with more stability guarantees, you get the ability to roll back quickly.

There are other tools at our disposal --- e.g. command-line flags, config, other kinds of research.

Here my first instinct would be to say this should be a command-line flag. To start out, we can keep the historical behavior as a default, but introduce a command-line option for the new behavior. This way, people can pass the negation of that command-line option if they want the older behavior, throughout the transition.

For example (please ignore names):
 Step 0: introduce
	git submodule update --remote --default-to-master; # current behavior
	git submodule update --remote --no-default-to-master; # new behavior
 and treat plain "git submodule update --remote" as --default-to-master.
 Step 1: when neither --default-to-master nor --no-default-to-master
 has been passed, warn when encountering a submodule with no branch
 and treat it as "master".
 Step 2: when neither --default-to-master nor --no-default-to-master
 has been passed, error out when encountering a submodule with no
 branch.
 Step 3: when neither --default-to-master nor --no-default-to-master
 has been passed, warn when encountering a submodule with no branch
 and treat it as pinned.
 Step 4: eliminate the warning.
What do you think?

Thanks, Jonathan

Previous: Stefan BellerNext: Stefan Beller
Message 4 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.