Subject: Re: [PATCH v8 05/11] submodule: allow runtime enabling extensions.submodulePathConfig

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 8 Jan 2026 07:46:49 +0100

On Thu, Jan 08, 2026 at 01:01:39AM +0200, Adrian Ratiu wrote:
> diff --git a/t/t7425-submodule-gitdir-path-extension.sh b/t/t7425-submodule-gitdir-path-extension.sh
> index 453183e27c..6cb844e809 100755
> --- a/t/t7425-submodule-gitdir-path-extension.sh
> +++ b/t/t7425-submodule-gitdir-path-extension.sh
> @@ -157,4 +157,129 @@ test_expect_success 'fetch mixed submodule changes and verify updates' '
>  	)
>  '
>  
> +test_expect_success '`git init` respects init.defaultSubmodulePathConfig' '
> +	git config --global init.defaultSubmodulePathConfig true &&
> +	git init repo-init &&
> +	git -C repo-init config extensions.submodulePathConfig > actual &&
> +	echo true > expect &&
> +	test_cmp expect actual &&
> +	# create a submodule and check gitdir
> +	(
> +		cd repo-init &&
> +		git init -b main sub &&
> +		test_commit -C sub sub-initial &&
> +		git submodule add ./sub sub &&
> +		git config submodule.sub.gitdir > actual &&
> +		echo ".git/modules/sub" > expect &&
> +		test_cmp expect actual
> +	) &&
> +	git config --global --unset init.defaultSubmodulePathConfig

We have `test_config ()` to handle setting and unsetting for you. Also,
this function uses `test_when_finished ()` so that we unset the config
even if the test fails.

You have the same pattern in a test further down and in patch 6.

Patrick