t5004: avoid using tar for empty packages
ea2d20d4c2 ("t5004: avoid using tar for checking emptiness of archive", 2013-05-09), introduced a fake empty tar archive to allow for portable tests of emptiness without having to invoke tar 4318094047 ("archive: don't add empty directories to archives", 2017-09-13) changed the expected result for its tests from one containing an empty directory to a plain empty archive but the portable test wasn't updated resulting on them failing again in (at least) NetBSD and OpenBSD Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Carlo Marcelo Arenas Belón committed
Dec 1, 2018 at 18:40 UTC
b6bdc2a0f5342e73de9f6e92884ddbb28ce04090
1 file changed
+8
-9
t/t5004-archive-corner-cases.sh
+8
-9
@@ -3,8 +3,12 @@
3
test_description='test corner cases of git-archive'
4
. ./test-lib.sh
5
6
-test_expect_success 'create commit with empty tree' '
7
- git commit --allow-empty -m foo
6
+# the 10knuls.tar file is used to test for an empty git generated tar
7
+# without having to invoke tar because an otherwise valid empty GNU tar
8
+# will be considered broken by {Open,Net}BSD tar
9
+test_expect_success 'create commit with empty tree and fake empty tar' '
10
+ git commit --allow-empty -m foo &&
11
+ perl -e "print \"\\0\" x 10240" >10knuls.tar
12
'
13
14
# 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' '
51
52
test_expect_success 'tar archive of empty tree is empty' '
53
git archive --format=tar HEAD: >empty.tar &&
50
- perl -e "print \"\\0\" x 10240" >10knuls.tar &&
54
test_cmp_bin 10knuls.tar empty.tar
55
'
56
@@ -106,16 +109,12 @@ test_expect_success 'create a commit with an empty subtree' '
109
110
test_expect_success 'archive empty subtree with no pathspec' '
111
git archive --format=tar $root_tree >subtree-all.tar &&
109
- make_dir extract &&
110
- "$TAR" xf subtree-all.tar -C extract &&
111
- check_dir extract
112
+ test_cmp_bin 10knuls.tar subtree-all.tar
113
'
114
115
test_expect_success 'archive empty subtree by direct pathspec' '
116
git archive --format=tar $root_tree -- sub >subtree-path.tar &&
116
- make_dir extract &&
117
- "$TAR" xf subtree-path.tar -C extract &&
118
- check_dir extract
117
+ test_cmp_bin 10knuls.tar subtree-path.tar
118
'
119
120
ZIPINFO=zipinfo