diff options
Diffstat (limited to 'archive-zip.c')
-rw-r--r-- | archive-zip.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/archive-zip.c b/archive-zip.c index e8913e5a26..5a62351ab1 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -6,6 +6,7 @@ #include "archive.h" #include "streaming.h" #include "utf8.h" +#include "object-store.h" #include "userdiff.h" #include "xdiff-interface.h" @@ -276,7 +277,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) { @@ -309,12 +310,12 @@ static int write_zip_entry(struct archiver_args *args, if (is_utf8(path)) flags |= ZIP_UTF8; else - warning("Path is not valid UTF-8: %s", path); + warning(_("path is not valid UTF-8: %s"), path); } if (pathlen > 0xffff) { - return error("path too long (%d chars, SHA1: %s): %s", - (int)pathlen, sha1_to_hex(sha1), path); + return error(_("path too long (%d chars, SHA1: %s): %s"), + (int)pathlen, oid_to_hex(oid), path); } if (S_ISDIR(mode) || S_ISGITLINK(mode)) { @@ -325,7 +326,8 @@ 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 = oid_object_info(args->repo, oid, + &size); method = 0; attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) : @@ -337,18 +339,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, &type, &size, NULL); if (!stream) - return error("cannot stream blob %s", - sha1_to_hex(sha1)); + return error(_("cannot stream blob %s"), + oid_to_hex(oid)); flags |= ZIP_STREAM; out = buffer = NULL; } else { - buffer = sha1_file_to_archive(args, path, sha1, mode, - &type, &size); + buffer = object_file_to_archive(args, path, oid, mode, + &type, &size); if (!buffer) - return error("cannot read %s", - sha1_to_hex(sha1)); + return error(_("cannot read %s"), + oid_to_hex(oid)); crc = crc32(crc, buffer, size); is_binary = entry_is_binary(path_without_prefix, buffer, size); @@ -356,8 +358,8 @@ 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)); + return error(_("unsupported file mode: 0%o (SHA1: %s)"), mode, + oid_to_hex(oid)); } if (creator_version > max_creator_version) @@ -465,7 +467,7 @@ static int write_zip_entry(struct archiver_args *args, zstream.avail_in = readlen; result = git_deflate(&zstream, 0); if (result != Z_OK) - die("deflate error (%d)", result); + die(_("deflate error (%d)"), result); out_len = zstream.next_out - compressed; if (out_len > 0) { @@ -600,7 +602,7 @@ static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time) struct tm *t; if (date_overflows(*timestamp)) - die("timestamp too large for this system: %"PRItime, + die(_("timestamp too large for this system: %"PRItime), *timestamp); time = (time_t)*timestamp; t = localtime(&time); |