From: Karthik Nayak Date: Mon, 26 Oct 2026 15:01:53 GMT Subject: Re: [PATCH v4 1/4] pack-write: make index-pack output comment hash agnostic Message-ID: In-Reply-To: <20261021182528.3055494-2-jltobler@gmail.com> Justin Tobler writes: > The code comment in `index_pack_lockfile()` explains the expected format > of output from git-index-pack(1). As written it explicitly mentions > SHA1, but both the git-index-pack(1) output and the parsing are not > specific to SHA1 and also support SHA256. > > Update the comment explanation to be hash agnostic accordingly. > > Signed-off-by: Justin Tobler > --- > pack-write.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/pack-write.c b/pack-write.c > index 85674e4b72..b1311c9923 100644 > --- a/pack-write.c > +++ b/pack-write.c > @@ -476,11 +476,15 @@ char *index_pack_lockfile(struct odb_source *source, int ip_out, > const int len = source->odb->repo->hash_algo->hexsz + 6; > > /* > - * The first thing we expect from index-pack's output > - * is "pack\t%40s\n" or "keep\t%40s\n" (46 bytes) where > - * %40s is the newly created pack SHA1 name. In the "keep" > - * case, we need it to remove the corresponding .keep file > - * later on. If we don't get that then tough luck with it. > + * The first thing we expect from index-pack's output is > + * "pack\t\n" or "keep\t\n", where is the hexadecimal > + * name of the packfile it has just written. The line is therefore five > + * bytes of prefix, `hexsz` bytes of name, and a trailing newline. A > + * "keep" prefix tells us that index-pack has also created the > + * corresponding ".keep" file. > + * > + * In the "keep" case, we need it to remove the corresponding ".keep" > + * file later on. If we don't get that then tough luck with it. We start off saying we expect either '"pack\t\n" or "keep\t\n"'. But the last line makes it seem like the latter is always expected? Is that the case, or should this comment be moved to the caller in 'fetch-pack.c'? > */ > if (read_in_full(ip_out, packname, len) == len && packname[len-1] == '\n') { > const char *name; > -- > 2.56.0.173.gf57c9a7388