summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-07-03 15:36:54 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-07-03 15:36:54 -0700
commit250ee16c14c8b37b437fbfc7345313d7db32b95d (patch)
tree282b6cfa7b92e184a20e29817b4547added44f78 /t
parentMerge branch 'rh/merge-options-doc-fix' into maint (diff)
parentt5004: resurrect original empty tar archive test (diff)
downloadtgif-250ee16c14c8b37b437fbfc7345313d7db32b95d.tar.xz
Merge branch 'rs/empty-archive' into maint
* rs/empty-archive: t5004: resurrect original empty tar archive test t5004: avoid using tar for checking emptiness of archive Conflicts: t/t5004-archive-corner-cases.sh
Diffstat (limited to 't')
-rwxr-xr-xt/t5004-archive-corner-cases.sh15
-rw-r--r--t/t5004/empty-with-pax-header.tarbin0 -> 10240 bytes
2 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 &&
diff --git a/t/t5004/empty-with-pax-header.tar b/t/t5004/empty-with-pax-header.tar
new file mode 100644
index 0000000000..da9e39e6cf
--- /dev/null
+++ b/t/t5004/empty-with-pax-header.tar
Binary files differ