Re: [PATCH 1/9] init: allow overriding the default branch name for new repositories
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Jun 11, 2020, 23:46 UTC
- Message-ID
- <20200611234611.GA6569@camp.crustytoothpaste.net>
- In-Reply-To
- <xmqqwo4di49l.fsf@gitster.c.googlers.com>
On 2020-06-11 at 23:14:46, Junio C Hamano wrote:
Show 18 quoted lines
> Alban Gruin <alban.gruin@gmail.com> writes:
>
> > 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'?
>
> Can you produce such a patch that does it cleanly? My knee jerk
> reaction is that I would suspect that you end up having to touch
> many places in the t/ scripts, but if you prove otherwise, that
> would certainly be appreciated.
>
> And no,
>
> git () { command git -c core.defaultBranchName=master "$@" }
>
> is not an acceptable solution.I would also be delighted to see such a solution, but my experience with the SHA-256 work tells me there's unlikely to be one. We do a lot of "git init" operations in random places in the test suite and as a consequence it's very hard to make a change without touching a large number of tests.
If we were writing things today, perhaps we would use a function (e.g., test_init_repo or such) to wrap this case, but we unfortunately didn't think about that and we're stuck with what we have now unless someone retrofits the test suite.
-- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204