Skip to content

Commit

Permalink
t0001: fix GIT_* environment variable check under --valgrind
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Sixt authored and Junio C Hamano committed Mar 3, 2016
1 parent 8384c13 commit f3858f8
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions t/t0001-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,17 @@ test_expect_success 'plain nested in bare through aliased command' '
'

test_expect_success 'No extra GIT_* on alias scripts' '
(
env | sed -ne "/^GIT_/s/=.*//p" &&
echo GIT_PREFIX && # setup.c
echo GIT_TEXTDOMAINDIR # wrapper-for-bin.sh
) | sort | uniq >expected &&
cat <<-\EOF >script &&
#!/bin/sh
env | sed -ne "/^GIT_/s/=.*//p" | sort >actual
exit 0
write_script script <<-\EOF &&
env |
sed -n \
-e "/^GIT_PREFIX=/d" \
-e "/^GIT_TEXTDOMAINDIR=/d" \
-e "/^GIT_/s/=.*//p" |
sort
EOF
chmod 755 script &&
./script >expected &&
git config alias.script \!./script &&
( mkdir sub && cd sub && git script ) &&
( mkdir sub && cd sub && git script >../actual ) &&
test_cmp expected actual
'

Expand Down

0 comments on commit f3858f8

Please sign in to comment.