git-lfs/t/t-submodule-recurse.sh
brian m. carlson 9e006ac4e2
Rename default branch in tests to "main"
Currently, our default branch in tests is "master".  This is the Git
default, but the Git default will likely change in the future, so it
makes sense to update our testsuite to be explicit about the branch
name.  We'll ensure this continues by building against older versions of
Git as well as newer versions.

We use "main" for the new branch name, since that's the proposed value
upstream.

This commit was made entirely by automated means using the following
command:

  git grep -l master t | xargs sed -i -e 's/master/main/g'
2020-07-08 15:38:17 +00:00

65 lines
1.4 KiB
Bash

#!/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 main
subcommit1=$(git rev-parse HEAD)
echo "bar" > file.dat
git add file.dat
git commit -a -m "update file"
git push origin main
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 main
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