summaryrefslogtreecommitdiff
path: root/archive-zip.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2019-02-19 00:05:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-01 02:57:39 (GMT)
commitbbf05cf70e5d0ba113ea4ed4c7c77cb890707911 (patch)
tree385cde5377863205a589bf0bbf71cd06727a826b /archive-zip.c
parent87003d2c94985f9b3c5ef23b9c042ae3b4ede6bb (diff)
downloadgit-bbf05cf70e5d0ba113ea4ed4c7c77cb890707911.zip
git-bbf05cf70e5d0ba113ea4ed4c7c77cb890707911.tar.gz
git-bbf05cf70e5d0ba113ea4ed4c7c77cb890707911.tar.bz2
archive: convert struct archiver_args to object_id
Change the commit_sha1 member to be called "commit_oid" and change it to be a pointer to struct object_id. Additionally, update some uses of GIT_SHA1_HEXSZ and hard-coded values to use the_hash_algo instead. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'archive-zip.c')
-rw-r--r--archive-zip.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/archive-zip.c b/archive-zip.c
index 155ee4a..4d66b5b 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -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);