summaryrefslogtreecommitdiff
path: root/t/t5004-archive-corner-cases.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t5004-archive-corner-cases.sh')
-rwxr-xr-xt/t5004-archive-corner-cases.sh22
1 files changed, 18 insertions, 4 deletions
diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh
index cdb7d7a7f9..67f3b54bed 100755
--- a/t/t5004-archive-corner-cases.sh
+++ b/t/t5004-archive-corner-cases.sh
@@ -23,17 +23,31 @@ check_dir() {
echo "$dir/$i"
done
} | sort >expect &&
- find "$dir" -print | sort >actual &&
+ find "$dir" ! -name pax_global_header -print | sort >actual &&
test_cmp expect actual
}
-test_expect_success 'tar archive of empty tree is empty' '
- git archive --format=tar HEAD >empty.tar &&
+
+# 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.tar -C 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 &&
+ test_cmp 10knuls.tar empty.tar
+'
+
test_expect_success 'tar archive of empty tree with prefix' '
git archive --format=tar --prefix=foo/ HEAD >prefix.tar &&
make_dir extract &&