From: Justin Tobler <jltobler@gmail.com>
To: git@vger.kernel.org
Cc: ps@pks.im, Justin Tobler <jltobler@gmail.com>
Subject: [PATCH v2 1/4] pack-write: make index-pack output comment hash agnostic
Date: Fri, 16 Oct 2026 16:37:13 -0500 [thread overview]
Message-ID: <20261016213716.593278-2-jltobler@gmail.com> (raw)
In-Reply-To: <20261016213716.593278-1-jltobler@gmail.com>
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 <jltobler@gmail.com>
---
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<name>\n" or "keep\t<name>\n", where <name> 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.
*/
if (read_in_full(ip_out, packname, len) == len && packname[len-1] == '\n') {
const char *name;
--
2.56.0.173.gf57c9a7388
next prev parent reply other threads:[~2026-10-16 21:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 2:28 [PATCH 0/3] object-file: fix ".keep" lockfile ownership in ODB transactions Justin Tobler
2026-10-16 2:28 ` [PATCH 1/3] pack-write: lift and expose index-pack report parsing Justin Tobler
2026-10-16 6:58 ` Patrick Steinhardt
2026-10-16 17:30 ` Justin Tobler
2026-10-16 2:29 ` [PATCH 2/3] object-file: explicitly write ".keep" lockfile Justin Tobler
2026-10-16 6:58 ` Patrick Steinhardt
2026-10-16 18:37 ` Justin Tobler
2026-10-16 2:29 ` [PATCH 3/3] object-file: write ".keep" lockfiles during transaction commit Justin Tobler
2026-10-16 6:58 ` Patrick Steinhardt
2026-10-16 19:22 ` Justin Tobler
2026-10-16 21:37 ` [PATCH v2 0/4] object-file: fix ".keep" lockfile ownership in ODB transactions Justin Tobler
2026-10-16 21:37 ` Justin Tobler [this message]
2026-10-16 21:37 ` [PATCH v2 2/4] pack-write: lift and expose index-pack report parsing Justin Tobler
2026-10-16 21:37 ` [PATCH v2 3/4] object-file: explicitly write ".keep" lockfile Justin Tobler
2026-10-16 21:37 ` [PATCH v2 4/4] object-file: write ".keep" lockfiles during transaction commit Justin Tobler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261016213716.593278-2-jltobler@gmail.com \
--to=jltobler@gmail.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.