Subject: Re: [PATCH v2 3/4] t9902: switch default branch name to main

From: Phillip Wood <[email-masked]>
Date: Tue, 9 Sep 2025 10:12:34 +0100

On 05/09/2025 13:14, Patrick Steinhardt wrote:
> On Thu, Sep 04, 2025 at 02:21:31PM +0100, Phillip Wood wrote:
>> diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
>> index 6650d33fba6..964e1f15693 100755
>> --- a/t/t9902-completion.sh
>> +++ b/t/t9902-completion.sh
>> @@ -11,9 +11,9 @@ test_description='test bash completion'
>>   # untraceable with such ancient Bash versions.
>>   test_untraceable=UnfortunatelyYes
>>   
>> -# Override environment and always use master for the default initial branch
>> +# Override environment and always use main for the default initial branch
>>   # name for these tests, so that rev completion candidates are as expected.
>> -GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
>> +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
>>   export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
>>   
>>   . ./lib-bash.sh
>> @@ -1453,7 +1453,7 @@ test_expect_success 'git bisect - start subcommand arguments before double-dash
>>   		HEAD Z
>>   		final Z
>>   		initial Z
>> -		master Z
>> +		main Z
>>   		EOF
>>   	)
>>   '
> 
> Hm. Wouldn't it be preferable to do something like the below patch
> instead? We would potentially also have to sort the output, but like
> this we don't care about the initial branch name at all.

If we're going to do that then I'd strongly prefer that we have the test 
suite set something like TEST_DEFAULT_BRANCH and use that instead of 
forking "git branch" or "git symbolic-ref" everywhere. It keeps the 
tests cleaner and avoids slowing the test suite down by adding a bunch 
of new processes.

As this patch series is focused on removing 
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main rather than making tests 
independent of the default branch name I'd prefer to leave this patch as is.

Thanks

Phillip

> Patrick
> 
> diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
> index 6650d33fba..321005a06a 100755
> --- a/t/t9902-completion.sh
> +++ b/t/t9902-completion.sh
> @@ -11,11 +11,6 @@ test_description='test bash completion'
>   # untraceable with such ancient Bash versions.
>   test_untraceable=UnfortunatelyYes
>   
> -# Override environment and always use master for the default initial branch
> -# name for these tests, so that rev completion candidates are as expected.
> -GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
> -export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
> -
>   . ./lib-bash.sh
>   
>   complete ()
> @@ -1449,11 +1444,11 @@ test_expect_success 'setup for git-bisect tests requiring a repo' '
>   test_expect_success 'git bisect - start subcommand arguments before double-dash are completed as revs' '
>   	(
>   		cd git-bisect &&
> -		test_completion "git bisect start " <<-\EOF
> +		test_completion "git bisect start " <<-EOF
>   		HEAD Z
>   		final Z
>   		initial Z
> -		master Z
> +		$(git branch --show-current) Z
>   		EOF
>   	)
>   '
>