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>
René Scharfe committed
Aug 27, 2021 at 21:59 UTC
e124ecf7f7643c83c4f23badb8e1437f863549c7
1 file changed
+3
-4
archive.c
+3
-4
@@ -191,7 +191,7 @@ static int write_archive_entry(const struct object_id *oid, const char *base,
191
return err;
192
}
193
194
-static void queue_directory(const unsigned char *sha1,
194
+static void queue_directory(const struct object_id *oid,
195
struct strbuf *base, const char *filename,
196
unsigned mode, struct archiver_context *c)
197
{
@@ -203,7 +203,7 @@ static void queue_directory(const unsigned char *sha1,
203
d->mode = mode;
204
c->bottom = d;
205
d->len = xsnprintf(d->path, len, "%.*s%s/", (int)base->len, base->buf, filename);
206
- oidread(&d->oid, sha1);
206
+ oidcpy(&d->oid, oid);
207
}
208
209
static int write_directory(struct archiver_context *c)
@@ -250,8 +250,7 @@ static int queue_or_write_archive_entry(const struct object_id *oid,
250
251
if (check_attr_export_ignore(check))
252
return 0;
253
- queue_directory(oid->hash, base, filename,
254
- mode, c);
253
+ queue_directory(oid, base, filename, mode, c);
254
return READ_TREE_RECURSIVE;
255
}
256