b2ddccd90d
The printf(1) command, like it's C cousin, takes a format string as its first argument. If a shell variable is passed as the first argument, it will be interpreted as a format string; this can lead to surprising behavior and can cause the test suite to fail if we accidentally insert a format string character into the variable. Modify all the places in the individual tests that we use a plain quoted variable as the format string by running the following Ruby one-liner: ruby -i -pe '$_.gsub!(/printf "\$/, %q(printf "%s" "$))' t/t-*.sh Avoid modifying the test helpers, as there are places (such as calc_oid) where we want to pass text containing escapes (such as "\n") and have those be properly interpreted by printf(1).
76 lines
2.0 KiB
Bash
Executable File
76 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
. "$(dirname "$0")/testlib.sh"
|
|
lfsname="submodule-config-test-lfs"
|
|
reponame="submodule-config-test-repo"
|
|
submodname="submodule-config-test-submodule"
|
|
|
|
begin_test "submodule env with .lfsconfig"
|
|
(
|
|
set -e
|
|
|
|
# setup dummy repo with lfs store
|
|
# no git data will be pushed, just lfs objects
|
|
setup_remote_repo "$lfsname"
|
|
echo $GITSERVER/$lfsname.git/info/lfs
|
|
|
|
# setup submodule
|
|
setup_remote_repo "$submodname"
|
|
clone_repo "$submodname" submod
|
|
mkdir dir
|
|
git config -f .lfsconfig lfs.url "$GITSERVER/$lfsname.git/info/lfs"
|
|
git lfs track "*.dat"
|
|
submodcontent="submodule lfs file"
|
|
submodoid=$(calc_oid "$submodcontent")
|
|
printf "%s" "$submodcontent" > dir/test.dat
|
|
git add .lfsconfig .gitattributes dir
|
|
git commit -m "create submodule"
|
|
git push origin master
|
|
|
|
assert_server_object "$lfsname" "$submodoid"
|
|
|
|
# setup repo with submodule
|
|
setup_remote_repo "$reponame"
|
|
clone_repo "$reponame" repo
|
|
git config -f .lfsconfig lfs.url "$GITSERVER/$lfsname.git/info/lfs"
|
|
git submodule add "$GITSERVER/$submodname" sub
|
|
git submodule update
|
|
git lfs track "*.dat"
|
|
mkdir dir
|
|
repocontent="repository lfs file"
|
|
repooid=$(calc_oid "$repocontent")
|
|
printf "%s" "$repocontent" > dir/test.dat
|
|
git add .gitattributes .lfsconfig .gitmodules dir sub
|
|
git commit -m "create repo"
|
|
git push origin master
|
|
|
|
assert_server_object "$lfsname" "$repooid"
|
|
|
|
echo "repo"
|
|
git lfs env | tee env.log
|
|
grep "Endpoint=$GITSERVER/$lfsname.git/info/lfs (auth=basic)$" env.log
|
|
|
|
cd sub
|
|
echo "./sub"
|
|
git lfs env | tee env.log
|
|
grep "Endpoint=$GITSERVER/$lfsname.git/info/lfs (auth=basic)$" env.log
|
|
|
|
cd dir
|
|
echo "./sub/dir"
|
|
git lfs env | tee env.log
|
|
grep "Endpoint=$GITSERVER/$lfsname.git/info/lfs (auth=basic)$" env.log
|
|
)
|
|
end_test
|
|
|
|
begin_test "submodule update --init --remote with .lfsconfig"
|
|
(
|
|
set -e
|
|
clone_repo "$reponame" clone
|
|
grep "$repocontent" dir/test.dat
|
|
|
|
git submodule update --init --remote
|
|
|
|
grep "$submodcontent" sub/dir/test.dat
|
|
)
|
|
end_test
|