summaryrefslogtreecommitdiff
path: root/archive-zip.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-03-12 02:27:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-14 16:23:48 (GMT)
commit015ff4f8225841d791c9940d71ebbce82c978a3c (patch)
tree947a476d1e9cd005038eab7cf0acb0b9a84dfeed /archive-zip.c
parenteedc994f18b608a805b31db0d40c13cce1b970fb (diff)
downloadgit-015ff4f8225841d791c9940d71ebbce82c978a3c.zip
git-015ff4f8225841d791c9940d71ebbce82c978a3c.tar.gz
git-015ff4f8225841d791c9940d71ebbce82c978a3c.tar.bz2
archive: convert write_archive_entry_fn_t to object_id
Convert the write_archive_entry_fn_t type to use a pointer to struct object_id. Convert various static functions in the tar and zip archivers also. 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.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/archive-zip.c b/archive-zip.c
index e8913e5..e2e5513 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -276,7 +276,7 @@ static int entry_is_binary(const char *path, const void *buffer, size_t size)
#define STREAM_BUFFER_SIZE (1024 * 16)
static int write_zip_entry(struct archiver_args *args,
- const unsigned char *sha1,
+ const struct object_id *oid,
const char *path, size_t pathlen,
unsigned int mode)
{
@@ -314,7 +314,7 @@ static int write_zip_entry(struct archiver_args *args,
if (pathlen > 0xffff) {
return error("path too long (%d chars, SHA1: %s): %s",
- (int)pathlen, sha1_to_hex(sha1), path);
+ (int)pathlen, oid_to_hex(oid), path);
}
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
@@ -325,7 +325,7 @@ static int write_zip_entry(struct archiver_args *args,
compressed_size = 0;
buffer = NULL;
} else if (S_ISREG(mode) || S_ISLNK(mode)) {
- enum object_type type = sha1_object_info(sha1, &size);
+ enum object_type type = sha1_object_info(oid->hash, &size);
method = 0;
attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) :
@@ -337,18 +337,18 @@ static int write_zip_entry(struct archiver_args *args,
if (S_ISREG(mode) && type == OBJ_BLOB && !args->convert &&
size > big_file_threshold) {
- stream = open_istream(sha1, &type, &size, NULL);
+ stream = open_istream(oid->hash, &type, &size, NULL);
if (!stream)
return error("cannot stream blob %s",
- sha1_to_hex(sha1));
+ oid_to_hex(oid));
flags |= ZIP_STREAM;
out = buffer = NULL;
} else {
- buffer = sha1_file_to_archive(args, path, sha1, mode,
+ buffer = sha1_file_to_archive(args, path, oid->hash, mode,
&type, &size);
if (!buffer)
return error("cannot read %s",
- sha1_to_hex(sha1));
+ oid_to_hex(oid));
crc = crc32(crc, buffer, size);
is_binary = entry_is_binary(path_without_prefix,
buffer, size);
@@ -357,7 +357,7 @@ static int write_zip_entry(struct archiver_args *args,
compressed_size = (method == 0) ? size : 0;
} else {
return error("unsupported file mode: 0%o (SHA1: %s)", mode,
- sha1_to_hex(sha1));
+ oid_to_hex(oid));
}
if (creator_version > max_creator_version)