2015-07-30 02:37:31 +00:00
|
|
|
#!/usr/bin/env bash
|
2015-06-16 14:07:26 +00:00
|
|
|
|
|
|
|
. "test/testlib.sh"
|
|
|
|
|
|
|
|
begin_test "untrack"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# no need to setup a remote repo, since this test doesn't need to push or pull
|
|
|
|
|
|
|
|
reponame="untrack"
|
2015-06-16 21:07:27 +00:00
|
|
|
git init $reponame
|
|
|
|
cd $reponame
|
2015-06-16 14:07:26 +00:00
|
|
|
|
|
|
|
# track *.jpg once
|
|
|
|
git lfs track "*.jpg" | grep "Tracking \*.jpg"
|
|
|
|
echo "* annex.backend=SHA512E" >> .gitattributes
|
|
|
|
|
|
|
|
git lfs untrack "*.jpg"
|
|
|
|
|
|
|
|
expected="* annex.backend=SHA512E"
|
|
|
|
[ "$expected" = "$(cat .gitattributes)" ]
|
|
|
|
)
|
|
|
|
end_test
|
|
|
|
|
|
|
|
begin_test "untrack outside git repo"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
2015-06-16 21:07:27 +00:00
|
|
|
reponame="outside"
|
|
|
|
mkdir $reponame
|
|
|
|
cd $reponame
|
|
|
|
|
2015-06-16 14:07:26 +00:00
|
|
|
git lfs untrack "*.foo" || {
|
|
|
|
# this fails if it's run outside of a git repo using GIT_LFS_TEST_DIR
|
|
|
|
|
|
|
|
# git itself returns an exit status of 128
|
|
|
|
# $ git show
|
|
|
|
# fatal: Not a git repository (or any of the parent directories): .git
|
|
|
|
# $ echo "$?"
|
|
|
|
# 128
|
|
|
|
|
|
|
|
[ "$?" = "128" ]
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -n "$GIT_LFS_TEST_DIR" ]; then
|
|
|
|
echo "GIT_LFS_TEST_DIR should be set outside of any Git repository"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
)
|
|
|
|
end_test
|