git-lfs/test/test-init.sh
rubyist 1dbc5a102c Isolate init tests
There's a race condition in the integration suite for anything that
relies on $HOME/.gitconfig. When the suite runs in parallel (by
default), a new $HOME/.gitconfig is copied in for each test that's run.
If a test is trying to modify and validate changes to this file, as the
init tests are, then it could be overwritten before the checks, causing
tests to fail.
2015-06-29 15:33:12 -04:00

45 lines
919 B
Bash
Executable File

#!/bin/sh
. "test/testlib.sh"
begin_test "init again"
(
set -e
tmphome="$(basename "$0" ".sh")"
mkdir -p $tmphome
cp $HOME/.gitconfig $tmphome/
HOME=$PWD/$tmphome
cd $HOME
[ "git-lfs smudge %f" = "$(git config filter.lfs.smudge)" ]
[ "git-lfs clean %f" = "$(git config filter.lfs.clean)" ]
git lfs init
[ "git-lfs smudge %f" = "$(git config filter.lfs.smudge)" ]
[ "git-lfs clean %f" = "$(git config filter.lfs.clean)" ]
)
end_test
begin_test "init with old settings"
(
set -e
tmphome="$(basename "$0" ".sh")"
mkdir -p $tmphome
HOME=$PWD/$tmphome
cd $HOME
git config --global filter.lfs.smudge "git lfs smudge %f"
git config --global filter.lfs.clean "git lfs clean %f"
git lfs init 2> init.log
grep "clean filter should be" init.log
[ "git lfs smudge %f" = "$(git config filter.lfs.smudge)" ]
[ "git lfs clean %f" = "$(git config filter.lfs.clean)" ]
)
end_test