Re: [PATCH 3/9] submodule: add gitdir path config override
- From
Josh Steadmon <steadmon@google.com>
- Date
- Aug 20, 2025, 19:37 UTC
- Message-ID
- <l4bmyst4qtew7kv7sdgzw5hibwor34zrh3c4jib7i6vlsniey6@jtku24uffrmo>
- In-Reply-To
- <20250816213642.3517822-4-adrian.ratiu@collabora.com>
On 2025.08.17 00:36, Adrian Ratiu wrote: [snip]
Show 7 quoted lines
> diff --git a/t/lib-verify-submodule-gitdir-path.sh b/t/lib-verify-submodule-gitdir-path.sh > new file mode 100644 > index 0000000000..fb5cb8eea4 > --- /dev/null > +++ b/t/lib-verify-submodule-gitdir-path.sh > @@ -0,0 +1,15 @@ > +# Helper to verify if repo $1 contains a submodule named $2 with gitdir in path $3
This comment is a bit inaccurate, right? If I'm reading correctly, we only verify that the submodule's gitdir actually exists in the "legacy" .git/modules/$path case. If we don't see anything there, we fall through to .git/submodules/$encoded_path, but we never verify it actually exists.
Show 49 quoted lines
> +
> +verify_submodule_gitdir_path() {
> + repo="$1" &&
> + name="$2" &&
> + path="$3" &&
> + (
> + cd "$repo" &&
> + cat >expect <<-EOF &&
> + $(git rev-parse --git-common-dir)/$path
> + EOF
> + git submodule--helper gitdir "$name" >actual &&
> + test_cmp expect actual
> + )
> +}
> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
> index 178c386212..f4d4fb8397 100755
> --- a/t/t7400-submodule-basic.sh
> +++ b/t/t7400-submodule-basic.sh
> @@ -13,6 +13,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
> export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
>
> . ./test-lib.sh
> +. "$TEST_DIRECTORY"/lib-verify-submodule-gitdir-path.sh
>
> test_expect_success 'setup - enable local submodules' '
> git config --global protocol.file.allow always
> @@ -1505,4 +1506,18 @@ test_expect_success 'submodule add fails when name is reused' '
> )
> '
>
> +test_expect_success 'submodule helper gitdir config overrides' '
> + verify_submodule_gitdir_path test-submodule child submodules/child &&
> + (
> + cd test-submodule &&
> + git config submodule.child.gitdirpath ".git/submodules/custom-child"
> + ) &&
> + verify_submodule_gitdir_path test-submodule child submodules/custom-child &&
> + (
> + cd test-submodule &&
> + git config --unset submodule.child.gitdirpath
> + ) &&
> + verify_submodule_gitdir_path test-submodule child submodules/child
> +'
> +
> test_done
> --
> 2.50.1.679.gbf363a8fbb.dirty
>
>