Re: [PATCH 1/9] init: allow overriding the default branch name for new repositories
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 14, 2020, 08:57 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2006141055510.56@tvgsbejvaqbjf.bet>
- In-Reply-To
- <731205c8-7d4b-d87a-17d1-520fdec7375d@gmail.com>
Hi Alban,
On Sat, 13 Jun 2020, Alban Gruin wrote:
Show 32 quoted lines
> Hi Junio,
>
> Le 12/06/2020 à 01:14, Junio C Hamano a écrit :
> > 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 wanted to to do something like this:
>
> if test -n "$GIT_TEST_DEFAULT_BRANCH_NAME";
> then
> git config core.defaultBranchName "$GIT_TEST_DEFAULT_BRANCH_NAME"
> fi
>
> But since we do not have a repository to store the config, it won't
> work. Sorry for the noise.We actually would have `~/.gitconfig` because `HOME` is set to `t/trash directory.<test-name>/`.
However, that would cause all kinds of issues when test scripts expect the directory to be pristine, containing only `.git/` but not `.gitconfig`.
It was a good idea to bring up; I share brian's sentiment that it would have been nice if it would have worked out.
Ciao, Dscho