Re: [PATCH 1/9] init: allow overriding the default branch name for new repositories
- From
Alban Gruin <alban.gruin@gmail.com>
- Date
- Jun 11, 2020, 10:23 UTC
- Message-ID
- <08e46af3-ff52-8bce-b75a-db8c390c9641@gmail.com>
- In-Reply-To
- <90912e32da1192cfc3b39a18cb606caa46e85b1c.1591823971.git.gitgitgadget@gmail.com>
Hi Don & Johannes,
Le 10/06/2020 à 23:19, Don Goodman-Wilson via GitGitGadget a écrit :
Show 21 quoted lines
> From: Don Goodman-Wilson <don@goodman-wilson.com> > > There is a growing number of projects trying to avoid the non-inclusive > name `master` in their repositories. For existing repositories, this > requires manual work. For new repositories, the only way to do that > automatically is by copying all of Git's template directory, then > hard-coding the desired default branch name into the `.git/HEAD` file, > and then configuring `init.templateDir` to point to those copied > template files. > > To make this process much less cumbersome, let's introduce support for > `core.defaultBranchName`. That way, users won't need to keep their > copied template files up to date, and won't interfere with default hooks > installed by their administrators. > > While at it, also let users set the default branch name via the > environment variable `GIT_TEST_DEFAULT_BRANCH_NAME`, in preparation for > adjusting Git's test suite to a more inclusive default branch name. As > is common in Git, the `GIT_TEST_*` variable takes precedence over the > config setting. >
Why adding yet another environment variable instead of relying only on a config option? I understand it's for the tests, but can't we add a shell function in test-lib.sh (and friends) that tries to read `GIT_TEST_DEFAULT_BRANCH_NAME', and, if it exists, sets `core.defaultBranchName'?
Cheers, Alban