archive: convert queue_directory to struct object_id

Pass the struct object_id on instead of just its hash member.
This is simpler and avoids the need to guess the algorithm.

Signed-off-by: René Scharfe <l.s.r@web.de>
Acked-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
René Scharfe 2021-08-27 21:59:16 +02:00 committed by Junio C Hamano
parent 225bc32a98
commit e124ecf7f7
1 changed files with 3 additions and 4 deletions

View File

@ -191,7 +191,7 @@ static int write_archive_entry(const struct object_id *oid, const char *base,
return err; 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, struct strbuf *base, const char *filename,
unsigned mode, struct archiver_context *c) unsigned mode, struct archiver_context *c)
{ {
@ -203,7 +203,7 @@ static void queue_directory(const unsigned char *sha1,
d->mode = mode; d->mode = mode;
c->bottom = d; c->bottom = d;
d->len = xsnprintf(d->path, len, "%.*s%s/", (int)base->len, base->buf, filename); d->len = xsnprintf(d->path, len, "%.*s%s/", (int)base->len, base->buf, filename);
oidread(&d->oid, sha1); oidcpy(&d->oid, oid);
} }


static int write_directory(struct archiver_context *c) 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)) if (check_attr_export_ignore(check))
return 0; return 0;
queue_directory(oid->hash, base, filename, queue_directory(oid, base, filename, mode, c);
mode, c);
return READ_TREE_RECURSIVE; return READ_TREE_RECURSIVE;
} }