Code

HOME must be set before calling git-init when creating test repositories
authorAlex Riesen <raa.lkml@gmail.com>
Sat, 26 Mar 2011 18:46:34 +0000 (19:46 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Mar 2011 08:13:36 +0000 (01:13 -0700)
Otherwise the created test repositories will be affected by users ~/.gitconfig.
For example, setting core.logAllrefupdates in users config will make all
calls to "git config --unset core.logAllrefupdates" fail which will break
the first test which uses the statement and expects it to succeed.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh

index 0fdc541a7cd7d6b694c4f4a3fd06b6cf21dc7380..c91e2324371edee46ebe3a49b540915e96469387 100644 (file)
@@ -1004,14 +1004,14 @@ rm -fr "$test" || {
        exit 1
 }
 
+HOME="$TRASH_DIRECTORY"
+export HOME
+
 test_create_repo "$test"
 # Use -P to resolve symlinks in our working directory so that the cwd
 # in subprocesses like git equals our $PWD (for pathname comparisons).
 cd -P "$test" || exit 1
 
-HOME=$(pwd)
-export HOME
-
 this_test=${0##*/}
 this_test=${this_test%%-*}
 for skp in $GIT_SKIP_TESTS