update tests so they pass if GIT_LFS_TEST_DIR is unset

This commit is contained in:
risk danger olson 2015-10-26 17:12:15 -06:00
parent da3ced10b9
commit cbafdbc7dc
4 changed files with 34 additions and 22 deletions

@ -6,13 +6,16 @@ begin_test "init again"
( (
set -e set -e
[ "git-lfs smudge %f" = "$(git config filter.lfs.smudge)" ] smudge="$(git config filter.lfs.smudge)"
[ "git-lfs clean %f" = "$(git config filter.lfs.clean)" ] clean="$(git config filter.lfs.clean)"
printf "$smudge" | grep "git-lfs smudge"
printf "$clean" | grep "git-lfs clean"
git lfs init git lfs init
[ "git-lfs smudge %f" = "$(git config filter.lfs.smudge)" ] [ "$smudge" = "$(git config filter.lfs.smudge)" ]
[ "git-lfs clean %f" = "$(git config filter.lfs.clean)" ] [ "$clean" = "$(git config filter.lfs.clean)" ]
) )
end_test end_test
@ -34,12 +37,12 @@ begin_test "init with old settings"
grep -E "(clean|smudge) attribute should be" init.log grep -E "(clean|smudge) attribute should be" init.log
[ `grep -c "(MISSING)" init.log` = "0" ] [ `grep -c "(MISSING)" init.log` = "0" ]
[ "git lfs smudge %f" = "$(git config filter.lfs.smudge)" ] [ "git lfs smudge %f" = "$(git config --global filter.lfs.smudge)" ]
[ "git lfs clean %f" = "$(git config filter.lfs.clean)" ] [ "git lfs clean %f" = "$(git config --global filter.lfs.clean)" ]
git lfs init --force git lfs init --force
[ "git-lfs smudge %f" = "$(git config filter.lfs.smudge)" ] [ "git-lfs smudge %f" = "$(git config --global filter.lfs.smudge)" ]
[ "git-lfs clean %f" = "$(git config filter.lfs.clean)" ] [ "git-lfs clean %f" = "$(git config --global filter.lfs.clean)" ]
) )
end_test end_test
@ -85,7 +88,7 @@ Git LFS initialized."
Git LFS initialized." = "$(git lfs init --force)" ] Git LFS initialized." = "$(git lfs init --force)" ]
[ "$pre_push_hook" = "$(cat .git/hooks/pre-push)" ] [ "$pre_push_hook" = "$(cat .git/hooks/pre-push)" ]
[ -n "$LFS_DOCKER" ] && exit 0 has_test_dir || exit 0
echo "test with bare repository" echo "test with bare repository"
cd .. cd ..
@ -127,16 +130,16 @@ begin_test "init --skip-smudge"
set -e set -e
git lfs init git lfs init
[ "git-lfs clean %f" = "$(git config filter.lfs.clean)" ] [ "git-lfs clean %f" = "$(git config --global filter.lfs.clean)" ]
[ "git-lfs smudge %f" = "$(git config filter.lfs.smudge)" ] [ "git-lfs smudge %f" = "$(git config --global filter.lfs.smudge)" ]
git lfs init --skip-smudge git lfs init --skip-smudge
[ "git-lfs clean %f" = "$(git config filter.lfs.clean)" ] [ "git-lfs clean %f" = "$(git config --global filter.lfs.clean)" ]
[ "git-lfs smudge --skip %f" = "$(git config filter.lfs.smudge)" ] [ "git-lfs smudge --skip %f" = "$(git config --global filter.lfs.smudge)" ]
git lfs init --force git lfs init --force
[ "git-lfs clean %f" = "$(git config filter.lfs.clean)" ] [ "git-lfs clean %f" = "$(git config --global filter.lfs.clean)" ]
[ "git-lfs smudge %f" = "$(git config filter.lfs.smudge)" ] [ "git-lfs smudge %f" = "$(git config --global filter.lfs.smudge)" ]
) )
end_test end_test
@ -169,7 +172,7 @@ begin_test "init --local outside repository"
set +e set +e
[ -n "$LFS_DOCKER" ] && exit 0 has_test_dir || exit 0
git lfs init --local 2> err.log git lfs init --local 2> err.log
res=$? res=$?

@ -6,8 +6,11 @@ begin_test "uninit outside repository"
( (
set -e set -e
[ "git-lfs smudge %f" = "$(git config filter.lfs.smudge)" ] smudge="$(git config filter.lfs.smudge)"
[ "git-lfs clean %f" = "$(git config filter.lfs.clean)" ] clean="$(git config filter.lfs.clean)"
printf "$smudge" | grep "git-lfs smudge"
printf "$clean" | grep "git-lfs clean"
# uninit multiple times to trigger https://github.com/github/git-lfs/issues/529 # uninit multiple times to trigger https://github.com/github/git-lfs/issues/529
git lfs uninit git lfs uninit
@ -15,8 +18,8 @@ begin_test "uninit outside repository"
git lfs uninit | tee uninit.log git lfs uninit | tee uninit.log
grep "configuration has been removed" uninit.log grep "configuration has been removed" uninit.log
[ "" = "$(git config filter.lfs.smudge)" ] [ "" = "$(git config --global filter.lfs.smudge)" ]
[ "" = "$(git config filter.lfs.clean)" ] [ "" = "$(git config --global filter.lfs.clean)" ]
cat $HOME/.gitconfig cat $HOME/.gitconfig
[ "$(grep 'filter "lfs"' $HOME/.gitconfig -c)" = "0" ] [ "$(grep 'filter "lfs"' $HOME/.gitconfig -c)" = "0" ]

@ -68,7 +68,7 @@ Run \`git lfs update --force\` to overwrite this hook."
[ "Updated pre-push hook." = "$(git lfs update --force)" ] [ "Updated pre-push hook." = "$(git lfs update --force)" ]
[ "$pre_push_hook" = "$(cat .git/hooks/pre-push)" ] [ "$pre_push_hook" = "$(cat .git/hooks/pre-push)" ]
[ -n "$LFS_DOCKER" ] && exit 0 has_test_dir || exit 0
echo "test with bare repository" echo "test with bare repository"
cd .. cd ..

@ -426,8 +426,14 @@ contains_same_elements() {
exit $res exit $res
} }
is_stdin_attached() { is_stdin_attached() {
test -t0 test -t0
echo $? echo $?
} }
has_test_dir() {
if [ -z "$GIT_LFS_TEST_DIR" ]; then
echo "No GIT_LFS_TEST_DIR. Skipping..."
exit 0
fi
}