diff options
Diffstat (limited to 'archive.c')
-rw-r--r-- | archive.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -191,7 +191,7 @@ static int write_archive_entry(const struct object_id *oid, const char *base, return err; } -static void queue_directory(const unsigned char *sha1, +static void queue_directory(const struct object_id *oid, struct strbuf *base, const char *filename, unsigned mode, struct archiver_context *c) { @@ -203,7 +203,7 @@ static void queue_directory(const unsigned char *sha1, d->mode = mode; c->bottom = d; d->len = xsnprintf(d->path, len, "%.*s%s/", (int)base->len, base->buf, filename); - hashcpy(d->oid.hash, sha1); + oidcpy(&d->oid, oid); } static int write_directory(struct archiver_context *c) @@ -250,8 +250,7 @@ static int queue_or_write_archive_entry(const struct object_id *oid, if (check_attr_export_ignore(check)) return 0; - queue_directory(oid->hash, base, filename, - mode, c); + queue_directory(oid, base, filename, mode, c); return READ_TREE_RECURSIVE; } @@ -275,9 +274,11 @@ int write_archive_entries(struct archiver_args *args, int err; struct strbuf path_in_archive = STRBUF_INIT; struct strbuf content = STRBUF_INIT; - struct object_id fake_oid = null_oid; + struct object_id fake_oid; int i; + oidcpy(&fake_oid, null_oid()); + if (args->baselen > 0 && args->base[args->baselen - 1] == '/') { size_t len = args->baselen; @@ -643,7 +644,7 @@ int write_archive(int argc, const char **argv, const char *prefix, args.pretty_ctx = &ctx; args.repo = repo; args.prefix = prefix; - string_list_init(&args.extra_files, 1); + string_list_init_dup(&args.extra_files); argc = parse_archive_args(argc, argv, &ar, &args, name_hint, remote); if (!startup_info->have_repository) { /* |