git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] archive: convert queue_directory to struct object_id
@ 2021-08-27 19:59 René Scharfe
  2021-08-27 20:40 ` brian m. carlson
  0 siblings, 1 reply; 3+ messages in thread
From: René Scharfe @ 2021-08-27 19:59 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] archive: convert queue_directory to struct object_id
  2021-08-27 19:59 [PATCH] archive: convert queue_directory to struct object_id René Scharfe
@ 2021-08-27 20:40 ` brian m. carlson
  2021-08-27 21:18   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: brian m. carlson @ 2021-08-27 20:40 UTC (permalink / raw)
  To: René Scharfe; +Cc: Git List, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

On 2021-08-27 at 19:59:16, René Scharfe wrote:
> 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.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] archive: convert queue_directory to struct object_id
  2021-08-27 20:40 ` brian m. carlson
@ 2021-08-27 21:18   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2021-08-27 21:18 UTC (permalink / raw)
  To: brian m. carlson; +Cc: René Scharfe, Git List

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> On 2021-08-27 at 19:59:16, René Scharfe wrote:
>> 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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-27 21:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 19:59 [PATCH] archive: convert queue_directory to struct object_id René Scharfe
2021-08-27 20:40 ` brian m. carlson
2021-08-27 21:18   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).