summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-01-14 15:29:30 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-01-14 15:29:30 -0800
commit37a99f8105ee9a1800a3ef2b00939bfdc38c9320 (patch)
tree6aa68a4fa0b9bf3dc2110d6e5998b2563dbd94d8
parentMerge branch 'cb/openbsd-allows-reading-directory' (diff)
parentt5004: avoid using tar for empty packages (diff)
downloadtgif-37a99f8105ee9a1800a3ef2b00939bfdc38c9320.tar.xz
Merge branch 'cb/t5004-empty-tar-archive-fix'
BSD port update. * cb/t5004-empty-tar-archive-fix: t5004: avoid using tar for empty packages
-rwxr-xr-xt/t5004-archive-corner-cases.sh17
1 files changed, 8 insertions, 9 deletions
diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh
index ced44355ca..271eb5a1fd 100755
--- a/t/t5004-archive-corner-cases.sh
+++ b/t/t5004-archive-corner-cases.sh
@@ -3,8 +3,12 @@
test_description='test corner cases of git-archive'
. ./test-lib.sh
-test_expect_success 'create commit with empty tree' '
- git commit --allow-empty -m foo
+# the 10knuls.tar file is used to test for an empty git generated tar
+# without having to invoke tar because an otherwise valid empty GNU tar
+# will be considered broken by {Open,Net}BSD tar
+test_expect_success 'create commit with empty tree and fake empty tar' '
+ git commit --allow-empty -m foo &&
+ perl -e "print \"\\0\" x 10240" >10knuls.tar
'
# Make a dir and clean it up afterwards
@@ -47,7 +51,6 @@ test_expect_success HEADER_ONLY_TAR_OK 'tar archive of commit with empty tree' '
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_bin 10knuls.tar empty.tar
'
@@ -106,16 +109,12 @@ test_expect_success 'create a commit with an empty subtree' '
test_expect_success 'archive empty subtree with no pathspec' '
git archive --format=tar $root_tree >subtree-all.tar &&
- make_dir extract &&
- "$TAR" xf subtree-all.tar -C extract &&
- check_dir extract
+ test_cmp_bin 10knuls.tar subtree-all.tar
'
test_expect_success 'archive empty subtree by direct pathspec' '
git archive --format=tar $root_tree -- sub >subtree-path.tar &&
- make_dir extract &&
- "$TAR" xf subtree-path.tar -C extract &&
- check_dir extract
+ test_cmp_bin 10knuls.tar subtree-path.tar
'
ZIPINFO=zipinfo