Skip to content

Commit 25d3d32

Browse files
René Scharfegitster
authored andcommitted
t0024, t5000: use test_lazy_prereq for UNZIP
This change makes the code smaller and we can put it at the top of the script, its rightful place as setup code. Signed-off-by: Rene Scharfe <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ac00128 commit 25d3d32

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

t/t0024-crlf-archive.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ test_description='respect crlf in git archive'
55
. ./test-lib.sh
66
GIT_UNZIP=${GIT_UNZIP:-unzip}
77

8+
test_lazy_prereq UNZIP '
9+
"$GIT_UNZIP" -v
10+
test $? -ne 127
11+
'
12+
813
test_expect_success setup '
914
1015
git config core.autocrlf true &&
@@ -26,13 +31,6 @@ test_expect_success 'tar archive' '
2631
2732
'
2833

29-
"$GIT_UNZIP" -v >/dev/null 2>&1
30-
if [ $? -eq 127 ]; then
31-
say "Skipping ZIP test, because unzip was not found"
32-
else
33-
test_set_prereq UNZIP
34-
fi
35-
3634
test_expect_success UNZIP 'zip archive' '
3735
3836
git archive --format=zip HEAD >test.zip &&

t/t5000-tar-tree.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ GUNZIP=${GUNZIP:-gzip -d}
3131

3232
SUBSTFORMAT=%H%n
3333

34+
test_lazy_prereq UNZIP '
35+
"$GIT_UNZIP" -v
36+
test $? -ne 127
37+
'
38+
3439
check_zip() {
3540
zipfile=$1.zip
3641
listfile=$1.lst
@@ -201,13 +206,6 @@ test_expect_success \
201206
test_cmp a/substfile2 g/prefix/a/substfile2
202207
'
203208

204-
"$GIT_UNZIP" -v >/dev/null 2>&1
205-
if [ $? -eq 127 ]; then
206-
say "Skipping ZIP tests, because unzip was not found"
207-
else
208-
test_set_prereq UNZIP
209-
fi
210-
211209
test_expect_success \
212210
'git archive --format=zip' \
213211
'git archive --format=zip HEAD >d.zip'

0 commit comments

Comments
 (0)