Skip to contentSkip to conversation

archive: convert queue_directory to struct object_id

PATCH In review René Scharfe 3 participants 3 messages Aug 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 archive.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
archive.c +3 -4
index 3c266d1d7b..a3bbb09125 100644
@@ -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);
-	oidread(&d->oid, 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;
 	}
 

--
2.33.0

#1 lore raw
Quoted 2 lines · René Scharfe

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

Seems reasonable.

Signature · 2 lines
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
#2 lore raw
Quoted 5 lines · brian m. carlson
Quoted 2 lines · René Scharfe

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

Seems reasonable.

I guess this is about the oidread() you added at the end of the function, so I'd take the above as your Acked-by ;-)

Thanks, both. Will queue.