aboutsummaryrefslogtreecommitdiff
path: root/archive-zip.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-01-20 17:22:27 -0800
committerJunio C Hamano <gitster@pobox.com>2013-01-20 17:22:27 -0800
commitca7ccd5f46d1fa59d5361d04dd8cdf0422973016 (patch)
treec1208b2b36ee9116ab8499978529e09e97644066 /archive-zip.c
parent1bc7a2b38f29e1336c91f57bc88d2391e0f72786 (diff)
parent5ea2c847c5938e9868f15a273869e54c6ed4c79c (diff)
downloadgit-ca7ccd5f46d1fa59d5361d04dd8cdf0422973016.tar.gz
git-ca7ccd5f46d1fa59d5361d04dd8cdf0422973016.tar.xz
Merge branch 'rs/zip-with-uncompressed-size-in-the-header' into maint
"git archive" did not record uncompressed size in the header when streaming a zip archive, which confused some implementations of unzip. * rs/zip-with-uncompressed-size-in-the-header: archive-zip: write uncompressed size into header even with streaming
Diffstat (limited to 'archive-zip.c')
-rw-r--r--archive-zip.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/archive-zip.c b/archive-zip.c
index 55f66b406..d3aef532b 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -240,7 +240,7 @@ static int write_zip_entry(struct archiver_args *args,
(mode & 0111) ? ((mode) << 16) : 0;
if (S_ISREG(mode) && args->compression_level != 0 && size > 0)
method = 8;
- compressed_size = size;
+ compressed_size = (method == 0) ? size : 0;
if (S_ISREG(mode) && type == OBJ_BLOB && !args->convert &&
size > big_file_threshold) {
@@ -313,10 +313,7 @@ static int write_zip_entry(struct archiver_args *args,
copy_le16(header.compression_method, method);
copy_le16(header.mtime, zip_time);
copy_le16(header.mdate, zip_date);
- if (flags & ZIP_STREAM)
- set_zip_header_data_desc(&header, 0, 0, 0);
- else
- set_zip_header_data_desc(&header, size, compressed_size, crc);
+ set_zip_header_data_desc(&header, size, compressed_size, crc);
copy_le16(header.filename_length, pathlen);
copy_le16(header.extra_length, ZIP_EXTRA_MTIME_SIZE);
write_or_die(1, &header, ZIP_LOCAL_HEADER_SIZE);