Skip to content

Commit f3858f8

Browse files
j6tgitster
authored andcommitted
t0001: fix GIT_* environment variable check under --valgrind
When a test case is run without --valgrind, the wrap-for-bin.sh helper script inserts the environment variable GIT_TEXTDOMAINDIR, but when run with --valgrind, the variable is missing. A recently introduced test case expects the presence of the variable, though, and fails under --valgrind. Rewrite the test case to strip conditially defined environment variables from both expected and actual output. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8384c13 commit f3858f8

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

t/t0001-init.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,17 @@ test_expect_success 'plain nested in bare through aliased command' '
8888
'
8989

9090
test_expect_success 'No extra GIT_* on alias scripts' '
91-
(
92-
env | sed -ne "/^GIT_/s/=.*//p" &&
93-
echo GIT_PREFIX && # setup.c
94-
echo GIT_TEXTDOMAINDIR # wrapper-for-bin.sh
95-
) | sort | uniq >expected &&
96-
cat <<-\EOF >script &&
97-
#!/bin/sh
98-
env | sed -ne "/^GIT_/s/=.*//p" | sort >actual
99-
exit 0
91+
write_script script <<-\EOF &&
92+
env |
93+
sed -n \
94+
-e "/^GIT_PREFIX=/d" \
95+
-e "/^GIT_TEXTDOMAINDIR=/d" \
96+
-e "/^GIT_/s/=.*//p" |
97+
sort
10098
EOF
101-
chmod 755 script &&
99+
./script >expected &&
102100
git config alias.script \!./script &&
103-
( mkdir sub && cd sub && git script ) &&
101+
( mkdir sub && cd sub && git script >../actual ) &&
104102
test_cmp expected actual
105103
'
106104

0 commit comments

Comments
 (0)