Merge branch 'rs/zip-with-uncompressed-size-in-the-header' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 21 Jan 2013 01:22:27 +0000 (17:22 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Jan 2013 01:22:27 +0000 (17:22 -0800)
"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

1  2 
archive-zip.c

diff --cc archive-zip.c
index 55f66b4060c64789bdb443f6c71f82a75ef22d0b,44b1dedd9cf0d41e64344470040e56efc82e9784..d3aef532b7e4b844f2ac9995b2e987d378737079
@@@ -313,12 -276,9 +313,9 @@@ static int write_zip_entry(struct archi
        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, 0);
 +      copy_le16(header.extra_length, ZIP_EXTRA_MTIME_SIZE);
        write_or_die(1, &header, ZIP_LOCAL_HEADER_SIZE);
        zip_offset += ZIP_LOCAL_HEADER_SIZE;
        write_or_die(1, path, pathlen);