Skip to content

Commit 482d549

Browse files
pks-tgitster
authored andcommitted
t1300: fix unset of GIT_CONFIG_NOSYSTEM leaking into subsequent tests
In order to test whether the new GIT_CONFIG_SYSTEM environment variable behaves as expected, we unset GIT_CONFIG_NOSYSTEM in one of our tests in t1300. But because tests are not executed in a subshell, this unset leaks into all subsequent tests and may thus cause them to fail in some environments. These failures are easily reproducable with `make prefix=/root test`. Fix the issue by not using `sane_unset GIT_CONFIG_NOSYSTEM`, but instead just manually add it to the environment of the two command invocations which need it. Reported-by: SZEDER Gábor <[email protected]> Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4179b48 commit 482d549

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

t/t1300-config.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,21 +2092,20 @@ test_expect_success 'override global and system config' '
20922092
git config --show-scope --list >output &&
20932093
test_cmp expect output &&
20942094
2095-
sane_unset GIT_CONFIG_NOSYSTEM &&
2096-
20972095
cat >expect <<-EOF &&
20982096
system system.config=true
20992097
global global.config=true
21002098
local local.config=true
21012099
EOF
2102-
GIT_CONFIG_SYSTEM=custom-system-config GIT_CONFIG_GLOBAL=custom-global-config \
2100+
GIT_CONFIG_NOSYSTEM=false GIT_CONFIG_SYSTEM=custom-system-config GIT_CONFIG_GLOBAL=custom-global-config \
21032101
git config --show-scope --list >output &&
21042102
test_cmp expect output &&
21052103
21062104
cat >expect <<-EOF &&
21072105
local local.config=true
21082106
EOF
2109-
GIT_CONFIG_SYSTEM=/dev/null GIT_CONFIG_GLOBAL=/dev/null git config --show-scope --list >output &&
2107+
GIT_CONFIG_NOSYSTEM=false GIT_CONFIG_SYSTEM=/dev/null GIT_CONFIG_GLOBAL=/dev/null \
2108+
git config --show-scope --list >output &&
21102109
test_cmp expect output
21112110
'
21122111

0 commit comments

Comments
 (0)