Subject: RE: [PATCH 2/2] t: use test_config whenever possible

From: Felipe Contreras <[email-masked]>
Date: Sat, 15 May 2021 15:15:46 -0500

Firmin Martin wrote:
> diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
> index ed11569d8d..ff18263171 100755
> --- a/t/t5526-fetch-submodules.sh
> +++ b/t/t5526-fetch-submodules.sh
> @@ -418,7 +418,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config
>  		git fetch --recurse-submodules
>  	) &&
>  	add_upstream_commit &&
> -	git config --global fetch.recurseSubmodules false &&
> +	test_config_global fetch.recurseSubmodules false &&
>  	head1=$(git rev-parse --short HEAD) &&
>  	git add submodule &&
>  	git commit -m "new submodule" &&
> @@ -429,11 +429,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config
>  	(
>  		cd downstream &&
>  		git config fetch.recurseSubmodules on-demand &&

Uhm:

  test_config fetch.recurseSubmodules on-demand &&

> -		git fetch >../actual.out 2>../actual.err
> -	) &&
> -	git config --global --unset fetch.recurseSubmodules &&
> -	(
> -		cd downstream &&
> +		git fetch >../actual.out 2>../actual.err &&
>  		git config --unset fetch.recurseSubmodules

Then the above line can be removed too.

>  	) &&
>  	test_must_be_empty actual.out &&
> @@ -446,7 +442,7 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
>  		git fetch --recurse-submodules
>  	) &&
>  	add_upstream_commit &&
> -	git config fetch.recurseSubmodules false &&
> +	test_config fetch.recurseSubmodules false &&
>  	head1=$(git rev-parse --short HEAD) &&
>  	git add submodule &&
>  	git commit -m "new submodule" &&
> @@ -457,11 +453,7 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
>  	(
>  		cd downstream &&
>  		git config submodule.submodule.fetchRecurseSubmodules on-demand &&

Ditto.

Very nice cleanup.

-- 
Felipe Contreras