summaryrefslogtreecommitdiff
path: root/t/t5004-archive-corner-cases.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-06-02 15:48:24 -0700
committerJunio C Hamano <gitster@pobox.com>2013-06-02 15:48:25 -0700
commit843fb919fd68739f3cc8f94e6a0225ead97e1e7e (patch)
treed434c8476b73714c06d04ebd71ab23c9302afe69 /t/t5004-archive-corner-cases.sh
parent499eaceb217df573fb3698d7a52e3e5a9b4173bc (diff)
parent56ee96572a7ec5a6b1a59ccdbbf204af16903d17 (diff)
downloadgit-843fb919fd68739f3cc8f94e6a0225ead97e1e7e.tar.gz
Merge branch 'rs/empty-archive'
Fixes tests added in 1.8.2 era that are broken on BSDs. * rs/empty-archive: t5004: resurrect original empty tar archive test t5004: avoid using tar for checking emptiness of archive
Diffstat (limited to 't/t5004-archive-corner-cases.sh')
-rwxr-xr-xt/t5004-archive-corner-cases.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh
index 8d1bbd356a..67f3b54bed 100755
--- a/t/t5004-archive-corner-cases.sh
+++ b/t/t5004-archive-corner-cases.sh
@@ -27,6 +27,21 @@ check_dir() {
test_cmp expect actual
}
+
+# bsdtar/libarchive versions before 3.1.3 consider a tar file with a
+# global pax header that is not followed by a file record as corrupt.
+if "$TAR" tf "$TEST_DIRECTORY"/t5004/empty-with-pax-header.tar >/dev/null 2>&1
+then
+ test_set_prereq HEADER_ONLY_TAR_OK
+fi
+
+test_expect_success HEADER_ONLY_TAR_OK 'tar archive of commit with empty tree' '
+ git archive --format=tar HEAD >empty-with-pax-header.tar &&
+ make_dir extract &&
+ "$TAR" xf empty-with-pax-header.tar -C extract &&
+ check_dir extract
+'
+
test_expect_success 'tar archive of empty tree is empty' '
git archive --format=tar HEAD: >empty.tar &&
perl -e "print \"\\0\" x 10240" >10knuls.tar &&