]> git.ipfire.org Git - thirdparty/git.git/commitdiff
archive tests: use a cheaper "zipinfo -h" invocation to get header
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sat, 23 Jan 2021 13:00:45 +0000 (14:00 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 23 Jan 2021 21:25:12 +0000 (13:25 -0800)
Change an invocation of zipinfo added in 19ee29401d (t5004: test ZIP
archives with many entries, 2015-08-22) to simply ask zipinfo for the
header info, rather than spewing out info about the entire archive and
race to kill it with SIGPIPE due to the downstream "head -2".

I ran across this because I'm adding a "set -o pipefail" test
mode. This won't be needed for the version of the mode that I'm
introducing (which currently relies on a patch to GNU bash), but I
think this is a good idea anyway.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5004-archive-corner-cases.sh

index 3e7b23cb32c581b88473b596036517a38c51c9fd..2d32d0ed122277089966b44f015b5f8ff6765e1c 100755 (executable)
@@ -153,7 +153,8 @@ test_expect_success ZIPINFO 'zip archive with many entries' '
 
        # check the number of entries in the ZIP file directory
        expr 65536 + 256 >expect &&
-       "$ZIPINFO" many.zip | head -2 | sed -n "2s/.* //p" >actual &&
+       "$ZIPINFO" -h many.zip >zipinfo &&
+       sed -n "2s/.* //p" <zipinfo >actual &&
        test_cmp expect actual
 '