Re: [PATCH 28/28] Change the default branch name to `main`
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 13, 2020, 14:09 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2011131500020.18437@tvgsbejvaqbjf.bet>
- In-Reply-To
- <87v9e9fujk.fsf@evledraar.gmail.com>
Hi Ævar,
On Fri, 13 Nov 2020, Ævar Arnfjörð Bjarmason wrote:
Show 11 quoted lines
> > On Thu, Nov 12 2020, Don Goodman-Wilson via GitGitGadget wrote: > > > The current default name for the initial branch is a loaded term, and > > many Open Source projects renamed their principal branches already. A > > common choice appears to be `main`. > > > > Let's follow their lead and change the default of `init.defaultBranch`. > > I think it makes sense to split this change off from a 28-series test > cleanup series.
It is not a test cleanup. It is a series of 27 patches preparing the test suite for the change made in the 28th patch.
I don't think that it is a good idea to split off that 28th patch from the patches whose entire purpose is to prepare for that 28th patch.
Show 15 quoted lines
>
> > diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
> > index bd3fa3c6da..1b0abcb0f8 100644
> > --- a/t/lib-submodule-update.sh
> > +++ b/t/lib-submodule-update.sh
> > @@ -144,7 +144,7 @@ create_lib_submodule_repo () {
> > git checkout -b valid_sub1 &&
> > git revert HEAD &&
> >
> > - git checkout "${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-master}"
> > + git checkout "${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-main}"
>
> Earlier in that function we're doing a "git init". With all this test
> cleanup I wonder why not just "git rev-parse --abbrev-ref" to get the
> default name, instead of carrying the hardcoding forward.My goal was to keep everything as close to its original as possible. In v2.29.2, this line reads:
git checkout master
See https://github.com/git/git/blob/v2.29.2/t/lib-submodule-update.sh#L147 to convince yourself.
Personally, I would have used something like
main=$(git symbolic-ref --short HEAD) && [...] git checkout $main
instead of what you suggested. That's a topic for another patch (series), though.
Ciao, Dscho