git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] archive: convert queue_directory to struct object_id

From
René Scharfe <l.s.r@web.de>
Date
Aug 27, 2021, 19:59 UTC
Message-ID
<bfdb36fc-3b92-fe62-e928-dc235cede31d@web.de>

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>
---
 archive.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/archive.c b/archive.c
index 3c266d1d7b..a3bbb09125 100644
--- a/archive.c
+++ b/archive.c
@@ -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
Next: brian m. carlson
Message 1 of 3 in “archive: convert queue_directory to struct object_id”
  1. archive: convert queue_directory to struct object_idRené Scharfe, Aug 27, 2021
  2. brian m. carlsonAug 27, 2021
  3. Junio C HamanoAug 27, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.