Skip to content

Commit

Permalink
Merge branch 'rs/zip-with-uncompressed-size-in-the-header'
Browse files Browse the repository at this point in the history
Improve compatibility of our zip output to fill uncompressed size
in the header, which we can do without seeking back (even though it
should not be necessary).

* rs/zip-with-uncompressed-size-in-the-header:
  archive-zip: write uncompressed size into header even with streaming
  • Loading branch information
gitster committed Jan 12, 2013
2 parents bf3f167 + 5ea2c84 commit d9f85f5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions archive-zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d9f85f5

Please sign in to comment.