archive-zip: support more than 65535 entries

Support more than 65535 entries cleanly by writing a "zip64 end of
central directory record" (with a 64-bit field for the number of
entries) before the usual "end of central directory record" (which
contains only a 16-bit field).  InfoZIP's zip does the same.
Archives with 65535 or less entries are not affected.

Programs that extract all files like InfoZIP's zip and 7-Zip
ignored the field and could extract all files already.  Software
that relies on the ZIP file directory to show a list of contained
files quickly to simulate to normal directory like Windows'
built-in ZIP functionality only saw a subset of the included files.

Windows supports ZIP64 since Vista according to
https://en.wikipedia.org/wiki/Zip_%28file_format%29#ZIP64.

Suggested-by: Johannes Schauer <josch@debian.org>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2015-08-22 21:06:45 +02:00
committed by Junio C Hamano
parent 0f747f9d37
commit 88329ca809
2 changed files with 91 additions and 4 deletions

View File

@ -122,7 +122,7 @@ test_lazy_prereq ZIPINFO '
test "x$n" = "x0"
'
test_expect_failure ZIPINFO 'zip archive with many entries' '
test_expect_success ZIPINFO 'zip archive with many entries' '
# add a directory with 256 files
mkdir 00 &&
for a in 0 1 2 3 4 5 6 7 8 9 a b c d e f