archive-zip: support files bigger than 4GB
commit4cdf3f9d84568da72f1dcade812de7a42ecb6d15
authorRené Scharfe <l.s.r@web.de>
Mon, 24 Apr 2017 17:33:34 +0000 (24 19:33 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 25 Apr 2017 05:10:51 +0000 (24 22:10 -0700)
treeee733137bc2857d624e12c6cdd2a357fb5a69302
parentaf95749f9b06467e7536da24432b00989a7c8c5a
archive-zip: support files bigger than 4GB

Write a zip64 extended information extra field for big files as part of
their local headers and as part of their central directory headers.
Also write a zip64 version of the data descriptor in that case.

If we're streaming then we don't know the compressed size at the time we
write the header.  Deflate can end up making a file bigger instead of
smaller if we're unlucky.  Write a local zip64 header already for files
with a size of 2GB or more in this case to be on the safe side.

Both sizes need to be included in the local zip64 header, but the extra
field for the directory must only contain 64-bit equivalents for 32-bit
values of 0xffffffff.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
archive-zip.c
t/t5004-archive-corner-cases.sh