Skip to content

Commit e4c62e6

Browse files
moygitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0d314ce commit e4c62e6

File tree

5 files changed

+3
-13
lines changed

5 files changed

+3
-13
lines changed

t/lib-cvs.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
. ./test-lib.sh
44

55
unset CVS_SERVER
6-
# for clean cvsps cache
7-
HOME=$(pwd)
8-
export HOME
96

107
if ! type cvs >/dev/null 2>&1
118
then

t/t0001-init.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ test_expect_success 'init with init.templatedir set' '
171171
mkdir templatedir-source &&
172172
echo Content >templatedir-source/file &&
173173
(
174-
HOME="`pwd`" &&
175-
export HOME &&
176174
test_config="${HOME}/.gitconfig" &&
177175
git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" &&
178176
mkdir templatedir-set &&
@@ -188,8 +186,6 @@ test_expect_success 'init with init.templatedir set' '
188186

189187
test_expect_success 'init --bare/--shared overrides system/global config' '
190188
(
191-
HOME="`pwd`" &&
192-
export HOME &&
193189
test_config="$HOME"/.gitconfig &&
194190
unset GIT_CONFIG_NOGLOBAL &&
195191
git config -f "$test_config" core.bare false &&
@@ -205,8 +201,6 @@ test_expect_success 'init --bare/--shared overrides system/global config' '
205201

206202
test_expect_success 'init honors global core.sharedRepository' '
207203
(
208-
HOME="`pwd`" &&
209-
export HOME &&
210204
test_config="$HOME"/.gitconfig &&
211205
unset GIT_CONFIG_NOGLOBAL &&
212206
git config -f "$test_config" core.sharedRepository 0666 &&

t/t5601-clone.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@ test_expect_success 'clone a void' '
163163

164164
test_expect_success 'clone respects global branch.autosetuprebase' '
165165
(
166-
HOME=$(pwd) &&
167-
export HOME &&
168166
test_config="$HOME/.gitconfig" &&
169167
unset GIT_CONFIG_NOGLOBAL &&
170168
git config -f "$test_config" branch.autosetuprebase remote &&

t/t9130-git-svn-authors-file.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ test_expect_success 'fresh clone with svn.authors-file in config' '
9595
(
9696
rm -r "$GIT_DIR" &&
9797
test x = x"$(git config svn.authorsfile)" &&
98-
HOME="`pwd`" &&
99-
export HOME &&
10098
test_config="$HOME"/.gitconfig &&
10199
unset GIT_CONFIG_NOGLOBAL &&
102100
unset GIT_DIR &&

t/test-lib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,9 @@ test_create_repo "$test"
865865
# in subprocesses like git equals our $PWD (for pathname comparisons).
866866
cd -P "$test" || exit 1
867867

868+
HOME=$(pwd)
869+
export HOME
870+
868871
this_test=${0##*/}
869872
this_test=${this_test%%-*}
870873
for skp in $GIT_SKIP_TESTS

0 commit comments

Comments
 (0)