Test submodule.recurse option

This unit test demonstrates an issue that’s present for users of the Git
configuration option submodule.recurse. When set to true, Git LFS
reproducibly fails with error messages from Git child processes claiming
that the command-line option --super-prefix isn’t supported by Git
commands including git version, git config, and git rev-parse.
This commit is contained in:
Patrick Lühne 2020-03-09 18:59:18 +01:00
parent 94921b8cce
commit 36926752c7
No known key found for this signature in database
GPG Key ID: 05F3611E97A70ABF

64
t/t-submodule-recurse.sh Normal file

@ -0,0 +1,64 @@
#!/usr/bin/env bash
. "$(dirname "$0")/testlib.sh"
reponame="submodule-recurse-test-repo"
submodname="submodule-recurse-test-submodule"
begin_test "submodule with submodule.recurse = true"
(
set -e
setup_remote_repo "$reponame"
setup_remote_repo "$submodname"
clone_repo "$submodname" submodule
git lfs track "*.dat" 2>&1 | tee track.log
grep "Tracking \"\*.dat\"" track.log
echo "foo" > file.dat
git add .gitattributes file.dat
git commit -a -m "add file"
git push origin master
subcommit1=$(git rev-parse HEAD)
echo "bar" > file.dat
git add file.dat
git commit -a -m "update file"
git push origin master
subcommit2=$(git rev-parse HEAD)
clone_repo "$reponame" repo
git submodule add "$GITSERVER/$submodname" submodule
git submodule update --init --recursive
git -C submodule reset --hard "$subcommit1"
git add .gitmodules submodule
git commit -m "add submodule"
git push origin master
git checkout -b feature
git -C submodule reset --hard "$subcommit2"
git add .gitmodules submodule
git commit -m "update submodule"
git push origin feature
clone_repo "$reponame" repo-no-recurse
git submodule update --init --recursive
git checkout feature
if [[ -d "submodule/lfs/logs" ]]
then
exit 1
fi
clone_repo "$reponame" repo-recurse
git config submodule.recurse true
git submodule update --init --recursive
git checkout feature
if [[ -d "submodule/lfs/logs" ]]
then
exit 1
fi
)
end_test