X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=archive-zip.c;h=18c0f8710c6150e3b0211d311a70bf4b34608370;hb=58dd4915ba1a933af0087e351743e31b2f9be878;hp=74e30f6205f41112dc2bafe9371a790aca55f70c;hpb=f1a82fe9a3de780fb2f1fe054d692294544f01e7;p=git.git diff --git a/archive-zip.c b/archive-zip.c index 74e30f620..18c0f8710 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -13,6 +13,7 @@ static int verbose; static int zip_date; static int zip_time; static const struct commit *commit; +static size_t base_len; static unsigned char *zip_dir; static unsigned int zip_dir_size; @@ -197,8 +198,8 @@ static int write_zip_entry(const unsigned char *sha1, if (S_ISREG(mode) && zlib_compression_level != 0) method = 8; result = 0; - buffer = sha1_file_to_archive(path, sha1, mode, &type, &size, - commit); + buffer = sha1_file_to_archive(path + base_len, sha1, mode, + &type, &size, commit); if (!buffer) die("cannot read %s", sha1_to_hex(sha1)); crc = crc32(crc, buffer, size); @@ -321,6 +322,7 @@ int write_zip_archive(struct archiver_args *args) zip_dir_size = ZIP_DIRECTORY_MIN_SIZE; verbose = args->verbose; commit = args->commit; + base_len = args->base ? strlen(args->base) : 0; if (args->base && plen > 0 && args->base[plen - 1] == '/') { char *base = xstrdup(args->base);