Skip to content

Commit ac00128

Browse files
René Scharfegitster
authored andcommitted
t0024, t5000: clear variable UNZIP, use GIT_UNZIP instead
InfoZIP's unzip takes default parameters from the environment variable UNZIP. Unset it in the test library and use GIT_UNZIP for specifying alternate versions of the unzip command instead. t0024 wasn't even using variable for the actual extraction. t5000 was, but when setting it to InfoZIP's unzip it would try to extract from itself (because it treats the contents of $UNZIP as parameters), which failed of course. Signed-off-by: Rene Scharfe <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1599999 commit ac00128

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

t/t0024-crlf-archive.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
test_description='respect crlf in git archive'
44

55
. ./test-lib.sh
6-
UNZIP=${UNZIP:-unzip}
6+
GIT_UNZIP=${GIT_UNZIP:-unzip}
77

88
test_expect_success setup '
99
@@ -26,7 +26,7 @@ test_expect_success 'tar archive' '
2626
2727
'
2828

29-
"$UNZIP" -v >/dev/null 2>&1
29+
"$GIT_UNZIP" -v >/dev/null 2>&1
3030
if [ $? -eq 127 ]; then
3131
say "Skipping ZIP test, because unzip was not found"
3232
else
@@ -37,7 +37,7 @@ test_expect_success UNZIP 'zip archive' '
3737
3838
git archive --format=zip HEAD >test.zip &&
3939
40-
( mkdir unzipped && cd unzipped && unzip ../test.zip ) &&
40+
( mkdir unzipped && cd unzipped && "$GIT_UNZIP" ../test.zip ) &&
4141
4242
test_cmp sample unzipped/sample
4343

t/t5000-tar-tree.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ commit id embedding:
2525
'
2626

2727
. ./test-lib.sh
28-
UNZIP=${UNZIP:-unzip}
28+
GIT_UNZIP=${GIT_UNZIP:-unzip}
2929
GZIP=${GZIP:-gzip}
3030
GUNZIP=${GUNZIP:-gzip -d}
3131

@@ -37,9 +37,9 @@ check_zip() {
3737
dir=$1
3838
dir_with_prefix=$dir/$2
3939

40-
test_expect_success UNZIP " extract ZIP archive" "
41-
(mkdir $dir && cd $dir && $UNZIP ../$zipfile)
42-
"
40+
test_expect_success UNZIP " extract ZIP archive" '
41+
(mkdir $dir && cd $dir && "$GIT_UNZIP" ../$zipfile)
42+
'
4343

4444
test_expect_success UNZIP " validate filenames" "
4545
(cd ${dir_with_prefix}a && find .) | sort >$listfile &&
@@ -201,7 +201,7 @@ test_expect_success \
201201
test_cmp a/substfile2 g/prefix/a/substfile2
202202
'
203203

204-
$UNZIP -v >/dev/null 2>&1
204+
"$GIT_UNZIP" -v >/dev/null 2>&1
205205
if [ $? -eq 127 ]; then
206206
say "Skipping ZIP tests, because unzip was not found"
207207
else

t/test-lib.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ unset VISUAL EMAIL LANGUAGE COLUMNS $("$PERL_PATH" -e '
8585
.*_TEST
8686
PROVE
8787
VALGRIND
88+
UNZIP
8889
PERF_AGGREGATING_LATER
8990
));
9091
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
@@ -128,6 +129,7 @@ fi
128129
unset CDPATH
129130

130131
unset GREP_OPTIONS
132+
unset UNZIP
131133

132134
case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in
133135
1|2|true)

0 commit comments

Comments
 (0)