Skip to content

Commit

Permalink
Merge branch 'rs/empty-archive' into maint
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Jul 3, 2013
2 parents 15afe95 + 56ee965 commit 250ee16
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions t/t5004-archive-corner-cases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
Binary file added t/t5004/empty-with-pax-header.tar
Binary file not shown.

0 comments on commit 250ee16

Please sign in to comment.