fix config reading in tests
Previously, we set the GIT_CONFIG environment variable in our tests so that only that file was read. However, setting it to a static value is not correct, since we are not necessarily always in the same directory; instead, we want the usual git config file lookup to happen. To do this, we stop setting GIT_CONFIG, which means that we must now suppress the reading of the system-wide and user configs. This exposes an incorrect test in t1500, which is also fixed (the incorrect test worked because we were failing to read the core.bare value from the config file, since the GIT_CONFIG variable was pointing us to the wrong file). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Feb 6, 2008 at 05:11 UTC
8bfa6bd6473b086ab2c5781daa08a7b5417c3d1f
2 files changed
+7
-4
t/t1500-rev-parse.sh
+2
-2
@@ -33,9 +33,9 @@ test_rev_parse() {
33
test_rev_parse toplevel false false true ''
34
35
cd .git || exit 1
36
-test_rev_parse .git/ true true false ''
36
+test_rev_parse .git/ false true false ''
37
cd objects || exit 1
38
-test_rev_parse .git/objects/ true true false ''
38
+test_rev_parse .git/objects/ false true false ''
39
cd ../.. || exit 1
40
41
mkdir -p sub/dir || exit 1
t/test-lib.sh
+5
-2
@@ -324,8 +324,11 @@ test_done () {
324
PATH=$(pwd)/..:$PATH
325
GIT_EXEC_PATH=$(pwd)/..
326
GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
327
-GIT_CONFIG=.git/config
328
-export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG
327
+unset GIT_CONFIG
328
+unset GIT_CONFIG_LOCAL
329
+GIT_CONFIG_NOSYSTEM=1
330
+GIT_CONFIG_NOGLOBAL=1
331
+export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL
332
333
GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
334
export GITPERLLIB