{"thread":{"id":"49931","subject":"[PATCH] t5004: avoid using tar for empty packages","startedAt":"2018-12-02T02:33:47Z","lastAt":"2018-12-02T02:33:47Z","messageCount":1,"participants":["Carlo Marcelo Arenas Belón"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"364428","messageId":"20181202023341.65044-1-carenas@gmail.com","threadId":"49931","inReplyTo":null,"subject":"[PATCH] t5004: avoid using tar for empty packages","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2018-12-02T02:33:41Z","receivedAt":"2018-12-02T02:33:47Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"ea2d20d4c2 (\"t5004: avoid using tar for checking emptiness of archive\",\n2013-05-09), introduced a fake empty tar archive to allow for portable\ntests of emptiness without having to invoke tar\n\n4318094047 (\"archive: don't add empty directories to archives\", 2017-09-13)\nchanged the expected result for its tests from one containing an empty\ndirectory to a plain empty archive but the portable test wasn't updated\nresulting on them failing again in (at least) NetBSD and OpenBSD\n\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n---\n t/t5004-archive-corner-cases.sh | 17 ++++++++---------\n 1 file changed, 8 insertions(+), 9 deletions(-)\n\ndiff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh\nindex ced44355ca..271eb5a1fd 100755\n--- a/t/t5004-archive-corner-cases.sh\n+++ b/t/t5004-archive-corner-cases.sh\n@@ -3,8 +3,12 @@\n test_description='test corner cases of git-archive'\n . ./test-lib.sh\n \n-test_expect_success 'create commit with empty tree' '\n-\tgit commit --allow-empty -m foo\n+# the 10knuls.tar file is used to test for an empty git generated tar\n+# without having to invoke tar because an otherwise valid empty GNU tar\n+# will be considered broken by {Open,Net}BSD tar\n+test_expect_success 'create commit with empty tree and fake empty tar' '\n+\tgit commit --allow-empty -m foo &&\n+\tperl -e \"print \\\"\\\\0\\\" x 10240\" >10knuls.tar\n '\n \n # Make a dir and clean it up afterwards\n@@ -47,7 +51,6 @@ test_expect_success HEADER_ONLY_TAR_OK 'tar archive of commit with empty tree' '\n \n test_expect_success 'tar archive of empty tree is empty' '\n \tgit archive --format=tar HEAD: >empty.tar &&\n-\tperl -e \"print \\\"\\\\0\\\" x 10240\" >10knuls.tar &&\n \ttest_cmp_bin 10knuls.tar empty.tar\n '\n \n@@ -106,16 +109,12 @@ test_expect_success 'create a commit with an empty subtree' '\n \n test_expect_success 'archive empty subtree with no pathspec' '\n \tgit archive --format=tar $root_tree >subtree-all.tar &&\n-\tmake_dir extract &&\n-\t\"$TAR\" xf subtree-all.tar -C extract &&\n-\tcheck_dir extract\n+\ttest_cmp_bin 10knuls.tar subtree-all.tar\n '\n \n test_expect_success 'archive empty subtree by direct pathspec' '\n \tgit archive --format=tar $root_tree -- sub >subtree-path.tar &&\n-\tmake_dir extract &&\n-\t\"$TAR\" xf subtree-path.tar -C extract &&\n-\tcheck_dir extract\n+\ttest_cmp_bin 10knuls.tar subtree-path.tar\n '\n \n ZIPINFO=zipinfo\n-- \n2.20.0.rc2\n\n"}]}