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

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 5 Sep 2025 14:14:38 +0200

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.

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
 	)
 '