Merge branch 'rs/zip-with-uncompressed-size-in-the-header'
authorJunio C Hamano <gitster@pobox.com>
Sat, 12 Jan 2013 02:34:55 +0000 (18:34 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 12 Jan 2013 02:34:55 +0000 (18:34 -0800)
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

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);