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 <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed Mar 3, 2016 at 07:55 UTC f3858f8edcb91054cdc0b6f086ec34109582f67f
1 file changed +9 -11
t/t0001-init.sh
+9 -11
@@ -88,19 +88,17 @@ test_expect_success 'plain nested in bare through aliased command' '
88 '
89
90 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
98 EOF
101 - chmod 755 script &&
99 + ./script >expected &&
100 git config alias.script \!./script &&
103 - ( mkdir sub && cd sub && git script ) &&
101 + ( mkdir sub && cd sub && git script >../actual ) &&
102 test_cmp expected actual
103 '
104