On 2025.08.17 00:36, Adrian Ratiu wrote: > Add some basic submodule tests for mixed gitdir path handling of > legacy (.git/modules) and new-style (.git/submodule) paths. > > For now these just test the coexistence, creation and push/pull of > submodules using mixed paths. > > More tests will be added later, especially for new-style encoding. > > Signed-off-by: Adrian Ratiu <adrian.ratiu@xxxxxxxxxxxxx> > --- > t/meson.build | 1 + > t/t7425-submodule-mixed-gitdir-paths.sh | 101 ++++++++++++++++++++++++ > 2 files changed, 102 insertions(+) > create mode 100755 t/t7425-submodule-mixed-gitdir-paths.sh > > diff --git a/t/meson.build b/t/meson.build > index bbeba1a8d5..ffd74f1d3b 100644 > --- a/t/meson.build > +++ b/t/meson.build > @@ -874,6 +874,7 @@ integration_tests = [ > 't7422-submodule-output.sh', > 't7423-submodule-symlinks.sh', > 't7424-submodule-mixed-ref-formats.sh', > + 't7425-submodule-mixed-gitdir-paths.sh', > 't7450-bad-git-dotfiles.sh', > 't7500-commit-template-squash-signoff.sh', > 't7501-commit-basic-functionality.sh', > diff --git a/t/t7425-submodule-mixed-gitdir-paths.sh b/t/t7425-submodule-mixed-gitdir-paths.sh > new file mode 100755 > index 0000000000..801e90522a > --- /dev/null > +++ b/t/t7425-submodule-mixed-gitdir-paths.sh > @@ -0,0 +1,101 @@ > +#!/bin/sh > + > +test_description='submodules handle mixed legacy and new (encoded) style gitdir paths' > + > +. ./test-lib.sh > + > +test_expect_success 'setup: allow file protocol' ' > + git config --global protocol.file.allow always > +' > + > +test_expect_success 'create repo with mixed new and legacy submodules' ' > + git init legacy-sub && > + test_commit -C legacy-sub legacy-initial && > + git -C legacy-sub config receive.denyCurrentBranch updateInstead && > + legacy_rev=$(git -C legacy-sub rev-parse HEAD) && > + > + git init new-sub && > + test_commit -C new-sub new-initial && > + git -C new-sub config receive.denyCurrentBranch updateInstead && > + new_rev=$(git -C new-sub rev-parse HEAD) && > + > + git init main && > + ( > + cd main && > + > + git config receive.denyCurrentBranch updateInstead && > + > + git submodule add ../new-sub new && > + test_commit new-sub && > + > + git submodule add ../legacy-sub legacy && > + test_commit legacy-sub && > + > + # simulate legacy .git/modules path by moving submodule > + mkdir -p .git/modules && > + mv .git/submodules/legacy .git/modules/ && > + echo "gitdir: ../.git/modules/legacy" > legacy/.git > + ) > +' > + > +test_expect_success 'clone from repo with both legacy and new-style submodules' ' > + git clone --recurse-submodules main cloned && > + ( > + cd cloned && > + > + # At this point, .git/modules/<name> should not exist as > + # submodules are checked out into the new path > + test_path_is_dir .git/submodules/legacy && > + test_path_is_dir .git/submodules/new && > + > + git submodule status >list && > + grep "$legacy_rev legacy" list && > + grep "$new_rev new" list > + ) You probably want to use `test_grep` here and below.