🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1241

[PATCH v2 13/13] doc: move pack index v3 documentation

#1241
From: Christian Couder
Date: Fri, 23 Oct 2026 07:25
105 lines
15958 bytes
From: "brian m. carlson" <sandals@crustytoothpaste.net>

Right now, we have our pack index v3 documentation in the hash function
transition document.  However, now that we've implemented pack index v3,
people will look for the index documentation in the normal place, so
copy it there.

We preserve it in the hash function transition document for
compatibility.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
 Documentation/gitformat-pack.adoc | 75 +++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/Documentation/gitformat-pack.adoc b/Documentation/gitformat-pack.adoc
index 3416edceab..19afbc881e 100644
--- a/Documentation/gitformat-pack.adoc
+++ b/Documentation/gitformat-pack.adoc
@@ -318,6 +318,81 @@ Pack file entry: <+
 
     Index checksum of all of the above.
 
+== Version 3 pack-*.idx files have the format:
+
+  - A header appears at the beginning and consists of the following:
+    * The 4-byte pack index signature: '\377t0c'
+    * 4-byte version number: 3
+    * 4-byte length of the header section, including the signature and
+      version number
+    * 4-byte number of objects contained in the pack
+    * 4-byte number of object formats in this pack index: 1 or 2
+    * For each object format:
+      ** 4-byte format identifier (e.g., 'sha1' for SHA-1)
+      ** 4-byte length in bytes of shortened object names. This is the
+        shortest possible length needed to make names in the shortened
+        object name table unambiguous.
+      ** 8-byte integer, recording where tables relating to this format
+        are stored in this index file, as an offset from the beginning.
+    * 8-byte offset to the trailer from the beginning of this file.
+    * Zero or more additional key/value pairs (4-byte key, 4-byte
+      value). Only one key is supported: 'PSRC'. See the "Loose objects
+      and unreachable objects" section of the hash function transition
+      document (`Documentation/technical/hash-function-transition.adoc`)
+      for supported values and how this is used.  All other keys are reserved. Readers must ignore
+      unrecognized keys.
+  - Zero or more NUL bytes. This can optionally be used to improve the
+    alignment of the full object name table below.
+  - Tables for the first object format:
+    * A sorted table of shortened object names.  These are prefixes of
+      the names of all objects in this pack file, packed together
+      without offset values to reduce the cache footprint of the binary
+      search for a specific object name.
+
+    * A table of full object names in pack order. This allows resolving
+      a reference to "the nth object in the pack file" (from a
+      reachability bitmap or from the next table of another object
+      format) to its object name.
+
+    * A table of 4-byte values mapping object name order to pack order.
+      For an object in the table of sorted shortened object names, the
+      value at the corresponding index in this table is the index in the
+      previous table for that same object.
+      This can be used to look up the object in reachability bitmaps or
+      to look up its name in another object format.
+
+    * A table of 4-byte CRC32 values of the packed object data, in the
+      order that the objects appear in the pack file. This is to allow
+      compressed data to be copied directly from pack to pack during
+      repacking without undetected data corruption.
+
+    * A table of 4-byte offset values. The index of this table in pack order
+      indicates where that object can be found in the pack file. These are
+      usually 31-bit pack file offsets, but large offsets are encoded as
+      an index into the next table with the most significant bit set.
+
+    * A table of 8-byte offset entries (empty for pack files less than
+      2 GiB). Pack files are organized with heavily used objects toward
+      the front, so most object references should not need to refer to
+      this table.
+  - Zero or more NUL bytes.
+  - Tables for the second object format, with the same layout as above,
+    up to and not including the table of CRC32 values.
+  - Zero or more NUL bytes.
+  - The trailer consists of the following:
+    * A copy of the hash checksum at the end of the corresponding
+      packfile.
+
+    * Hash checksum of all of the above.
+
+Note that the two hashes at the end of the index file are in whatever the
+repository's main algorithm is.  In the usual case when there are multiple
+algorithms, the main algorithm will be SHA-256 and the compatibility algorithm
+will be SHA-1.  Git always writes the main algorithm first, but doesn't require this.
+
+All 4-byte numbers are in network order and must be 4-byte aligned in the file,
+so the NUL padding may be required in some cases.
+
 == pack-*.rev files have the format:
 
   - A 4-byte magic number '0x52494458' ('RIDX').
-- 
2.56.0.215.g47fdf2208c
Technical Details
Message-ID: <20261023072559.3204273-14-christian.couder@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-72959-linux-kernel-git=dewy.ru
References: <20261023072559.3204273-1-christian.couder@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-72959-linux-kernel-git=dewy.ru
From: christian.couder@gmail.com (Christian Couder)
Newsgroups: linux.kernel.git
Subject: [PATCH v2 13/13] doc: move pack index v3 documentation
Date: Fri, 23 Oct 2026 09:25:58 +0200
Organization: Usenet Network
Message-ID: <20261023072559.3204273-14-christian.couder@gmail.com>
References: <20261023072559.3204273-1-christian.couder@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="438406"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:QsnGlytek+bxk2w3IHCD0yo0qr4= sha256:cZ4HZDkwQ2QTWDb39TFICHlbAW8oNgSbvjz5ghvlsM4=
	sha1:im8lMPDqlC++kqDYLidvq4wq+Y4= sha256:lj0RlQPwjh/ukAOSfX2oOLtAKBUmDetoIuCw+ZqeNgs=
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 B3CE611141F; Fri, 23 Oct 2026 10:32:11 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.948
X-Spam-Status: No, score=-0.948 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FORGED_GMAIL_RCVD=1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, 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 2SBRr5TArw_O;
	Fri, 23 Oct 2026 10:32:08 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-72959-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 382021113EF; Fri, 23 Oct 2026 10:32:00 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 938372D96E; Fri, 23 Oct 2026 07:26:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792740399;
	b=X2wLzMwF5sTfUm4YO6A8aG7mPfOVrvAm2bQLLzIu/UsWfRBZGxeDaTubBJHby99hjDQL
	 P3siiF6YRDF6PizSrZy+bFkv6UcOpobVAVTmvF0DAyaskMos1tYhgUz3e8DmvHyD+rFVH
	 A+87fZ2h1fKPp6noeY2zvWE4t65/SS/HIOp/iOTUcXWAQ9BQ8B289fLLVshFKMDU2tiEJ
	 LThmFx3Oli/Di5jq05HigrNow031KD00cQbYzefwAO5FcbpoMun6ny9Z6Zhwy2UuBGjWy
	 O80bfEYy3hQ8+xE1kFddpie0uz2vLPVIFnvV5EBgyFwtus/ax5eSKkFwYhRNe+Xs0zA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792740399;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=z1qgCZbhvFch6UnvjHpuT6WErWPuWQRZDUI56rGGsrA=;
	b=QG+y6Ub1QCkVmBYo8i1ohMn+s2AaChDdsFaKXdlNVwDo7u8wCjprG6cbT80tvbnvdd83
	 qaeA9aHxShADYF7uOlTXMPxdAjaLbyxKKJJiG0esLW1NWbfjmHdYCXJd2e9O4k+uCYGLh
	 LkW/D0OSETPbfOpo7PnSYdpQXx8q25ZwhJB4A5ujB9nO35JkTJGI5ZcfUARWpV5lcvUsg
	 0YslIW9Q5rfohS1oK/6dnSf0Q+O7vgCfg88ucsfCIztPGTurCII5JCb8F9CT7Z0iKrldA
	 EMmVfdHeKihwfus/0P1g+f1rAePPwnIrGnIyL6nTF84311NJY/WFNOqsIXOIkYoYGDA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=OjcOGyRt;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 25818606A333;
	Fri, 23 Oct 2026 07:26:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=OjcOGyRt
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.46
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792740398;
	b=UTOpQd/VF5pvhyVxTtVbhmWZI1Ji4Dw0ADpIvC9SzAOa/sLSW7lMweD3K3BzqA1FuNAk
	 530KNksa7k/LMaVsX+4wxJiT11bIW76XAr4YKePfH4PiZx0g6pYcpptqab/PbJl6rXGag
	 vYcayPzZxnANxTcamhq5K3STS0zhxxV7LAqNJ2UyT6a9+xeU23AC2nclkXRQsIdV5NO7s
	 MZ/GQp96B6+fXvYNgWaxOEujNd5bT0cszvMdj4xAoQRNL7+pL7YKIhZdpa10rHYo9jgug
	 2nNSg3V0q3OqzsU3P98dcSjY7gK6HBXAyA9rzLp0u38XyA0pGfKqGU2s+qxdwBbFz+A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792740398;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=z1qgCZbhvFch6UnvjHpuT6WErWPuWQRZDUI56rGGsrA=;
	b=WMmwB4foeb4Y8PiXEsqpqmLKS2kWHfCj+ZheE34ikG4Ws0phLbIskyEr54bjca6qb8Kk
	 f3ALPgzMB9mO0QG0ZARZqnJXRwj3zz2ykIgX2aAb/HzY2hKPjZXiUG9eqIofaFs4SZmXj
	 6vWaKpSJlGgkP/vf9Hfx+pgya+DGn1Ukg7uGcba6vFtfuudH32TA0dua1ggU5SWNS5LQc
	 6t/6CGIazgOs0RX99lxc+JhuOdSSgY9XL7ufRxF4KGbbC5zgXbsdP3Nnh2LoXbR7J+OgP
	 CczBfJK5hbh4ozdEFa6Ii0CR4SrziHS9ZgSG7PTgX4x7bDwoFpyOBBJ0bcrrgixvR5A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=OjcOGyRt;
	arc=none smtp.remote-ip=209.85.221.46
X-Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9AE960A2615
	for <git@vger.kernel.org>; Fri, 23 Oct 2026 07:26:37 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D9AE960A2615
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-wr1-f46.google.com with SMTP id ffacd0b85a97d-48e20ed3b9dso440384f8f.2
        for <git@vger.kernel.org>; Fri, 23 Oct 2026 00:26:37 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1792740396; x=1793345196; 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=z1qgCZbhvFch6UnvjHpuT6WErWPuWQRZDUI56rGGsrA=;
        b=OjcOGyRt2JImCPn3rGTwr6grVYuqnvNL+pQzDV2CNOxC4j1kgQVYBoCnRMDNGDl2Gc
         0nND+FEUrieC8F6Ea4BOfslhuNvuK9Kli0GkMTAixQQr6k8dRzV9AL3F3b/pEnOk6z6x
         vX5dc0BwLOr6H/QbhW1IXfvQY637QAsauBv+rO19L91UBRpDPwEQrc3ukJnoWOFZgO16
         dCxnw5ct1hBFZo62QkTspO8Qi/Nlhv0WEAhupUCWfSyPuizm8SBSfu7jpc8Nl5BYSaf8
         j4BDrH1zOgbLsSxOHZzo5tYQiDFaSVlTLVhwf0qUppklHG1u13yZPtByTB1+8PDLWEbH
         jCqg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792740396; x=1793345196;
        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=z1qgCZbhvFch6UnvjHpuT6WErWPuWQRZDUI56rGGsrA=;
        b=JW2in/gDP2ml6bcGnxEX+El5TKbEQArS0ZGMgTlKYecYJGlth6TdPeNhpyuf1yxy1c
         8W6AMo2qFgPcXe18B5tDDZE2HtyisrBKS4dhA0vR48wHJVx6e25TsIsM2qPReZs1QDL2
         PxNNQbsoX0o+YXJuh2FbqvtzMJ0VOKgHLlvSZzkIsMlOhHpdOABg8xH9XuC3/Gm//C5b
         bns2BSjINz69BEjozeX6dFLHAj9z+66td6C6y90mKZwIRLglw3NeudOyjmFj1MAh4q/5
         WGAz/dunnJRdpBxXPfvzkGHltCkykll3FxdB2c6Atc1Klx8LWVyT/VQlRIVyP5Er2MxC
         d5UQ==
X-Gm-Message-State: AFq9FYJqE0Na1mjXBVHrcdeXUoOj8AxYPMkUeXumQ2UOA8kA7r15P+Hf
	8vI21BJJ8vmiHtOTEvEpYma9cDlx1/ikCEagVisqb8fHwv2Cpo/8o90I0VZswA==
X-Gm-Gg: AYBFou2ji/dhQIl0zDX/lRRAsGSmpdFFakDX3rEkyW3GbYDbN5XdJ+sP+dtU0Q+QYVj
	KX3i71QOfsZEz+EdbERkEnCnbZAGwxqHLSlS7QrjUnxxCxEK4X+vWQDkNfzjbiMYTzIwAJOtArH
	b86QLpwE3Xn2zdc0dVsSc2fxwB2GdB24e6SeIjOJUKPyNKQAW1Ve1lDR+j1T6G7SQfcnxNkP8fq
	nozECD7+1fBVO0ZBNjD40KQ4otpQ4ThA+TcGXYC6iTunVcE15iLDvnqxc+5QpRW9waawD+up4S/
	7CUgEEHsmN/XSF21u42p+5YaPU4HADJt1Vt+3+3vN2gNp7ysFZmgmr65YkHCLUoqkvtSLtSWafK
	3UWPg32LLcPYpFaxLr2aSUf5lOmgIWn4HB4uKorJbmh2tHCn56ezbq51AnlH6iEKAouFJ8UY2Hn
	3X/xmPeGviH4qsNO8TnLGF6XKrCqBvN0NyhAtuA0vaBrKgTevAeF8V6fN06hSwCm2vnv44TqIwH
	LTnjzMbrLSPV0VlcWlNGZuLGy+ZU4lS2cogowsNFuDTvsEgOmMtcAisurSlSsBMJcBMZ7hUqiIc
	VVai3c8QDuIk5ZGwgWGNxom7onRMkIfXuNoj4ZubC8Hgj6v0dBXXcO3DvSvLnMTznMUFDclp3YH
	43kVKs9WhBS3i4wwXfVUAOfJNwXuZqFvJaznbCDgJs3kxqrnNGcBaVpTrd5zDJP1mhw==
X-Received: by 2002:a5d:5889:0:b0:48d:f99d:a0d3 with SMTP id ffacd0b85a97d-48e385ba756mr1704484f8f.46.1792740396163;
        Fri, 23 Oct 2026 00:26:36 -0700 (PDT)
X-Received: from christian--20230123--2G7D3 ([62.35.114.108])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e38055da4sm3228024f8f.43.2026.10.23.00.26.34
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 23 Oct 2026 00:26:35 -0700 (PDT)
X-Cc: Junio C Hamano <gitster@pobox.com>,
	"brian m . carlson" <sandals@crustytoothpaste.net>,
	Patrick Steinhardt <ps@pks.im>,
	Elijah Newren <newren@gmail.com>,
	Jeff King <peff@peff.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Christian Couder <christian.couder@gmail.com>
X-Mailer: git-send-email 2.56.0.215.g47fdf2208c
X-In-Reply-To: <20261023072559.3204273-1-christian.couder@gmail.com>
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list