@matheusbsbs / matheus-bagliano / commits / e4c62e640d
Fork 0

tests: factor HOME=$(pwd) in test-lib.sh

The same pattern is used in many tests, and makes it easy for new ones to rely on $HOME being a trashable, clean, directory. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthieu Moy committed Aug 30, 2010 at 11:50 UTC e4c62e640db3f704b4c27435c6b8efdb170988dc
5 files changed +3 -13
t/lib-cvs.sh
-3
@@ -3,9 +3,6 @@
3 . ./test-lib.sh
4
5 unset CVS_SERVER
6 -# for clean cvsps cache
7 -HOME=$(pwd)
8 -export HOME
6
7 if ! type cvs >/dev/null 2>&1
8 then
t/t0001-init.sh
-6
@@ -171,8 +171,6 @@ test_expect_success 'init with init.templatedir set' '
171 mkdir templatedir-source &&
172 echo Content >templatedir-source/file &&
173 (
174 - HOME="`pwd`" &&
175 - export HOME &&
174 test_config="${HOME}/.gitconfig" &&
175 git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" &&
176 mkdir templatedir-set &&
@@ -188,8 +186,6 @@ test_expect_success 'init with init.templatedir set' '
186
187 test_expect_success 'init --bare/--shared overrides system/global config' '
188 (
191 - HOME="`pwd`" &&
192 - export HOME &&
189 test_config="$HOME"/.gitconfig &&
190 unset GIT_CONFIG_NOGLOBAL &&
191 git config -f "$test_config" core.bare false &&
@@ -205,8 +201,6 @@ test_expect_success 'init --bare/--shared overrides system/global config' '
201
202 test_expect_success 'init honors global core.sharedRepository' '
203 (
208 - HOME="`pwd`" &&
209 - export HOME &&
204 test_config="$HOME"/.gitconfig &&
205 unset GIT_CONFIG_NOGLOBAL &&
206 git config -f "$test_config" core.sharedRepository 0666 &&
t/t5601-clone.sh
-2
@@ -163,8 +163,6 @@ test_expect_success 'clone a void' '
163
164 test_expect_success 'clone respects global branch.autosetuprebase' '
165 (
166 - HOME=$(pwd) &&
167 - export HOME &&
166 test_config="$HOME/.gitconfig" &&
167 unset GIT_CONFIG_NOGLOBAL &&
168 git config -f "$test_config" branch.autosetuprebase remote &&
t/t9130-git-svn-authors-file.sh
-2
@@ -95,8 +95,6 @@ test_expect_success 'fresh clone with svn.authors-file in config' '
95 (
96 rm -r "$GIT_DIR" &&
97 test x = x"$(git config svn.authorsfile)" &&
98 - HOME="`pwd`" &&
99 - export HOME &&
98 test_config="$HOME"/.gitconfig &&
99 unset GIT_CONFIG_NOGLOBAL &&
100 unset GIT_DIR &&
t/test-lib.sh
+3
@@ -865,6 +865,9 @@ test_create_repo "$test"
865 # in subprocesses like git equals our $PWD (for pathname comparisons).
866 cd -P "$test" || exit 1
867
868 +HOME=$(pwd)
869 +export HOME
870 +
871 this_test=${0##*/}
872 this_test=${this_test%%-*}
873 for skp in $GIT_SKIP_TESTS