test-lib: factor out $GIT_UNZIP setup
authorJeff King <peff@peff.net>
Mon, 11 Mar 2013 01:31:47 +0000 (21:31 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Mar 2013 03:06:19 +0000 (20:06 -0700)
We set up the $GIT_UNZIP variable and lazy prereq in
multiple places (and the next patch is about to add another
one). Let's factor it out to avoid repeating ourselves.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0024-crlf-archive.sh
t/t5003-archive-zip.sh
t/test-lib.sh
index 5378787e1b23bf18796c28c33533f677b389289c..4e9fa3cd68426942357d8f89ffa97ed3099e1084 100755 (executable)
@@ -3,12 +3,6 @@
 test_description='respect crlf in git archive'
 
 . ./test-lib.sh
-GIT_UNZIP=${GIT_UNZIP:-unzip}
-
-test_lazy_prereq UNZIP '
-       "$GIT_UNZIP" -v
-       test $? -ne 127
-'
 
 test_expect_success setup '
 
index 7cfe9ca3dacb1488aa44ea3643e1333d346feac7..0f5b42b8eddc358dca7bd318368edbac88fed349 100755 (executable)
@@ -3,15 +3,9 @@
 test_description='git archive --format=zip test'
 
 . ./test-lib.sh
-GIT_UNZIP=${GIT_UNZIP:-unzip}
 
 SUBSTFORMAT=%H%n
 
-test_lazy_prereq UNZIP '
-       "$GIT_UNZIP" -v
-       test $? -ne 127
-'
-
 test_lazy_prereq UNZIP_SYMLINKS '
        (
                mkdir unzip-symlinks &&
index ea1e4a03a7b61392c0a068cb55006165e9a7394a..e20fc6992267ea14b2af75ab928408fc8cc76b88 100644 (file)
@@ -750,3 +750,9 @@ test_lazy_prereq AUTOIDENT '
 # When the tests are run as root, permission tests will report that
 # things are writable when they shouldn't be.
 test -w / || test_set_prereq SANITY
+
+GIT_UNZIP=${GIT_UNZIP:-unzip}
+test_lazy_prereq UNZIP '
+       "$GIT_UNZIP" -v
+       test $? -ne 127
+'