Merge branch 'cb/fsmonitor-intfix' into maint
[gitweb.git] / archive-zip.c
index 155ee4a779a1c2cd0cb2a7a8eea8c7ba8ba8502a..4d66b5be6e889e865cc998d1c59076e05ebd4712 100644 (file)
@@ -577,7 +577,7 @@ static void write_zip64_trailer(void)
        write_or_die(1, &locator64, ZIP64_DIR_TRAILER_LOCATOR_SIZE);
 }
 
-static void write_zip_trailer(const unsigned char *sha1)
+static void write_zip_trailer(const struct object_id *oid)
 {
        struct zip_dir_trailer trailer;
        int clamped = 0;
@@ -590,14 +590,14 @@ static void write_zip_trailer(const unsigned char *sha1)
        copy_le16_clamp(trailer.entries, zip_dir_entries, &clamped);
        copy_le32(trailer.size, zip_dir.len);
        copy_le32_clamp(trailer.offset, zip_offset, &clamped);
-       copy_le16(trailer.comment_length, sha1 ? GIT_SHA1_HEXSZ : 0);
+       copy_le16(trailer.comment_length, oid ? the_hash_algo->hexsz : 0);
 
        write_or_die(1, zip_dir.buf, zip_dir.len);
        if (clamped)
                write_zip64_trailer();
        write_or_die(1, &trailer, ZIP_DIR_TRAILER_SIZE);
-       if (sha1)
-               write_or_die(1, sha1_to_hex(sha1), GIT_SHA1_HEXSZ);
+       if (oid)
+               write_or_die(1, oid_to_hex(oid), the_hash_algo->hexsz);
 }
 
 static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time)
@@ -635,7 +635,7 @@ static int write_zip_archive(const struct archiver *ar,
 
        err = write_archive_entries(args, write_zip_entry);
        if (!err)
-               write_zip_trailer(args->commit_sha1);
+               write_zip_trailer(args->commit_oid);
 
        strbuf_release(&zip_dir);