]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'rs/archive-zip-many' into maint
authorJunio C Hamano <gitster@pobox.com>
Fri, 4 Sep 2015 02:18:01 +0000 (19:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 4 Sep 2015 02:18:01 +0000 (19:18 -0700)
"git archive" did not use zip64 extension when creating an archive
with more than 64k entries, which nobody should need, right ;-)?

* rs/archive-zip-many:
  archive-zip: support more than 65535 entries
  archive-zip: use a local variable to store the creator version
  t5004: test ZIP archives with many entries

1  2 
archive-zip.c

diff --cc archive-zip.c
index ae3d67f9d310e2e34c6d2c5919eff467b951783f,480360d0aa66d298853ac7dadf1efc8747793e9a..9db47357b02d4c33fc4e2d1edb8d948b2b3a496f
@@@ -444,16 -530,19 +530,19 @@@ static void write_zip_trailer(const uns
        copy_le32(trailer.magic, 0x06054b50);
        copy_le16(trailer.disk, 0);
        copy_le16(trailer.directory_start_disk, 0);
-       copy_le16(trailer.entries_on_this_disk, zip_dir_entries);
-       copy_le16(trailer.entries, zip_dir_entries);
+       copy_le16_clamp(trailer.entries_on_this_disk, zip_dir_entries,
+                       &clamped);
+       copy_le16_clamp(trailer.entries, zip_dir_entries, &clamped);
        copy_le32(trailer.size, zip_dir_offset);
        copy_le32(trailer.offset, zip_offset);
 -      copy_le16(trailer.comment_length, sha1 ? 40 : 0);
 +      copy_le16(trailer.comment_length, sha1 ? GIT_SHA1_HEXSZ : 0);
  
        write_or_die(1, zip_dir, zip_dir_offset);
+       if (clamped)
+               write_zip64_trailer();
        write_or_die(1, &trailer, ZIP_DIR_TRAILER_SIZE);
        if (sha1)
 -              write_or_die(1, sha1_to_hex(sha1), 40);
 +              write_or_die(1, sha1_to_hex(sha1), GIT_SHA1_HEXSZ);
  }
  
  static void dos_time(time_t *time, int *dos_date, int *dos_time)