Article View: linux.kernel.git
Article #701[PATCH v2 1/4] pack-write: make index-pack output comment hash agnostic
From: Justin Tobler
Date: Fri, 16 Oct 2026 21:37
Date: Fri, 16 Oct 2026 21:37
40 lines
9464 bytes
9464 bytes
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
Technical Details
Message-ID:
<20261016213716.593278-2-jltobler@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72269-linux-kernel-git=dewy.ruReferences:
<20261016022901.3838402-1-jltobler@gmail.com> <20261016213716.593278-1-jltobler@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72269-linux-kernel-git=dewy.ru
From: jltobler@gmail.com (Justin Tobler)
Newsgroups: linux.kernel.git
Subject: [PATCH v2 1/4] pack-write: make index-pack output comment hash agnostic
Date: Fri, 16 Oct 2026 16:37:13 -0500
Organization: Usenet Network
Message-ID: <20261016213716.593278-2-jltobler@gmail.com>
References: <20261016022901.3838402-1-jltobler@gmail.com>
<20261016213716.593278-1-jltobler@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2891280"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:3f7p5GdsTBNck6yRZS44gs1yOTg= sha256:TjEm3HwrrbwbUO3Or0ePnAz9XK3BqvXMlpne9u7nLnM=
sha1:8/UBx/BVkUXZ1EJGLuvlwTKRPqw= sha256:hkSTG0Z5lpBI08MFD3h4EljsAT03MCPMZbMwc87AsHM=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 3946C110609; Sat, 17 Oct 2026 00:37:46 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.748
X-Spam-Status: No, score=-0.748 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id DSkwwHsaS561;
Sat, 17 Oct 2026 00:37:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-72269-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 97498110209; Sat, 17 Oct 2026 00:37:35 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by tor.lore.kernel.org (Postfix) with ESMTP id F0FC732073; Fri, 16 Oct 2026 21:37:32 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4898E4119E0;
Fri, 16 Oct 2026 21:37:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="asDo+Esw"
X-Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC0BA39EF12
for <git@vger.kernel.org>; Fri, 16 Oct 2026 21:37:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1792186651; cv=none; b=D6uA+2dqXrHq5VEO5QrgMwn8Oq5OZ0FAZniYeQHwXz5DXNvROUBZaE5k9Ra4LxPupihICUhcGF/4YqJyg7bXEhVkaQBHZ3qW6AIj6SzMucvJsYgf0CsG/c7PJ48EATmGE1dLkC6Bi1TOwV94w+z0fVjDPSYi46C1Dmzws8m+wNg=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1792186651; c=relaxed/simple;
bh=hgMZJZT5L6w4MYBgKFo1s4m5nxdztedSQDwRG3wRwrQ=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=NA7y5AGpTtSEredB04aZ+3hkmXL+gW+Rn65j916GSnXKXv4W5UiJNsXdVCCCCS9ED2QagGc5Mi6+ZAvZtNGGFRm4olY/nRxB1N25b+VffyF1E0spXz7er3Pv4zkfnm28NUpDPWT8e3a7IIK69ieRR9Bs8GGNH4+MbhgCzBT7mGA=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=asDo+Esw; arc=none smtp.client-ip=209.85.210.45
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-825b40f8a26so111067a34.1
for <git@vger.kernel.org>; Fri, 16 Oct 2026 14:37:29 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792186649; x=1792791449; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=mZ0GtOicRbRUKr5sSRH/XM5f0SvV2ByRoT2VB811qgY=;
b=asDo+EswhLAbbhOmWTiKK8U2h6t7i+ZYAA3llhK+rWgXmeWCR4w2uewy6s0ecwKMzN
gWJkc7GnUu3zi/6PpNZCWRyOYrPg/TrsOXJ/sS4vj7bFR/1NhoAojRMRZAnEo7SvJ4SP
Ok9e5oCXfTMvv+IQ6MhlVauBjCj+1EcTcLnK/ldFSOpnjDJ/PBrLqlCT5kodTOoDH5zX
Sq0WHdc4PByYlWirwGMo27HyWmT6NtJSWXfAhFr6fvEONqhuwoVI40g+5Il2DgHcqgjl
ZeieW3n8z6BTa8Jrq5WmLJpig+FX6kqwMlr/eWY+F3wIsYAv1+4cIf07cl9tSgofnFA2
Hr2w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792186649; x=1792791449;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=mZ0GtOicRbRUKr5sSRH/XM5f0SvV2ByRoT2VB811qgY=;
b=scPCtpzZA1C9lHmXU2clDZSwRuim6m65Dxx3AvGYpc6AGranAkyVRrYpNvwUAiYlCE
4E785kG4xc4nLW/dqSB9L6e3FyiddaSOSLxNcAaiR8D0mHXQzdfzsQ/90Y8oyqDCrnPR
T45He2owPQ7+Cxn/Kj1Dzek9PhCU0h5/NHrDgRKSbLr0PXhLkCBpQJeg2BrfIPQxT4Kg
S1cFNRdBYMroJMteuMePgwzuDqT+dPGT28JarwKAUtc67sUSHBVqA6QeZS9J8bYpGEF8
XMsraG+d1pQkOWPyPWqjIBCqPyVAAzzlbO/ESj/nEeOQvdVZYDFKYiG4IjH4PA+uChnn
BdlA==
X-Gm-Message-State: AFq9FYIvhn5mE05C1khqoCRwu/+mYk16Gs3ncjez094AQBT54PXM1vw1
50yV2W+FOyJVEolUNTLeGHYBYX/G2VSZY/VjsMcjaaYL/5w7VVPmzPUiklyutg==
X-Gm-Gg: AYBFou389Fxiv02zITGysY51esc/5Uq3di+GKAihSg5kn3HVWLvLe/QUTDqEOSHQ1kH
v0woa8iGrBtkx2C3kXjt7ORH5XZksQJwYeTUI2bMzwCX07M+HVO3HvJLxFXMsMslWz6kxDQ3FWe
SNoBjmQwDZsDBHXiirRCTW3lC4EJwaob9JBPk7h5CQMlYpnDb6mMUdhQ7IRUefysL3SDSkbU2kw
zV8PBsR+5OCr8p6ywwKhsENsBEXO03T5nDnXXuGl1kXBd/7FYN0L2O0+UwriWvbidG65C3TeV1q
09QZnHq/ix178SD3aWq6JtP9ltGSN76uypeuHL7UIRcYArfIjtTnOSwVje3KPtz7o/VeWTzvYYL
g9699i8riMs9twAJ82EM4saDPSfVTDOCgK7NmVl2jvL9CrnoYLgj0KeMqjo/Vc1iiho1vQS72UF
t91id6GVfbLF6Qu2E6H7bagTdULvQLQSHx5Bvly2qnk0V0Fy0kqXnfUiDXYq/WUJ9VmTt3PHbCP
8HJizI4GTmtJL5VE4HTp0DLCF0SogTc/9We5w==
X-Received: by 2002:a05:6830:2643:b0:81b:9d18:75c with SMTP id 46e09a7af769-844ffcdc21emr770964a34.20.1792186648832;
Fri, 16 Oct 2026 14:37:28 -0700 (PDT)
X-Received: from denethor.localdomain ([136.51.44.64])
by smtp.gmail.com with ESMTPSA id 46e09a7af769-844d2ffbf71sm834395a34.4.2026.10.16.14.37.28
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 16 Oct 2026 14:37:28 -0700 (PDT)
X-Cc: ps@pks.im,
Justin Tobler <jltobler@gmail.com>
X-Mailer: git-send-email 2.56.0.173.gf57c9a7388
X-In-Reply-To: <20261016213716.593278-1-jltobler@gmail.com>
X-Precedence: bulk
X-Mailing-List: git@vger.kernel.org
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>