Git development
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Christian Couder <christian.couder@gmail.com>,
	git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
	Elijah Newren <newren@gmail.com>, Jeff King <peff@peff.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH v2 07/13] builtin: populate pack index v3 fields when indexing
Date: Thu, 26 Nov 2026 22:27:47 +0000	[thread overview]
Message-ID: <awiyY0v5pUnWm-Gd@fruit.crustytoothpaste.net> (raw)
In-Reply-To: <xmqq1p87i7t1.fsf@gitster.g>

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

On 2026-11-26 at 21:47:38, Junio C Hamano wrote:
> Christian Couder <christian.couder@gmail.com> writes:
> > @@ -483,8 +493,15 @@ static void *unpack_entry_data(off_t offset, size_t size,
> >  		hdrlen = format_object_header(hdr, sizeof(hdr), type, size);
> >  		git_hash_init(&c, the_hash_algo);
> >  		git_hash_update(&c, hdr, hdrlen);
> > -	} else
> > +		if (compat && compat_oid) {
> > +			git_hash_init(&c_compat, compat);
> 
> Doesn't this regress indexing using v2, though?
> 
> Here in unpack_entry_data() (called with &obj->idx.compat_oid from
> parse_pack_objects()), and similarly in resolve_delta() when checking
> 'if (the_repository->compat_hash_algo)', the conversion runs even when
> opts.version < 3.  Because index-pack cannot yet convert commits or
> trees whose referenced objects appear later in the pack, running an
> ordinary 'git index-pack' writing a v2 index in a compat repository will
> now fail on packs that previously succeeded, even though '.compat_oid'
> is discarded for v2.  Gating compat calculation on 'opts.version >= 3'
> (for example, passing NULL for compat_oid from parse_pack_objects() when
> opts.version < 3, and checking opts.version >= 3 in resolve_delta())
> would avoid regressing v2 indexing.

You can't use index v2 (or v1) in a repository with compatibility object
IDs.  The reason is that we need the mapping preserved and v1 and v2
don't do that, so they lose data.  If we use v2 to index a pack that's
already been indexed or a pack that's the result of repacking one or
more packs and we have a compatibility algorithm, we've lost the mapping
and a large number of operations will simply die loudly since the
repository is effectively corrupt in that case.

I believe a later patch in the series will force v3 when there's a
compatibility algorithm in use.  This is much like SHA-256 bundles
always use bundle v3 since v2 can't express the hash algorithm in use.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Speaking for myself only

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

  reply	other threads:[~2026-11-26 22:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23  7:25 [PATCH v2 00/13] SHA-1/SHA-256 interoperability, part 3: pack index v3 Christian Couder
2026-10-23  7:25 ` [PATCH v2 01/13] loose: allow looking up in object map with source Christian Couder
2026-11-26 13:28   ` Kaartic Sivaraam
2026-10-23  7:25 ` [PATCH v2 02/13] loose: rename repo_add_loose_object_map Christian Couder
2026-11-26 13:35   ` Kaartic Sivaraam
2026-10-23  7:25 ` [PATCH v2 03/13] loose: add a flag to control whether we write mapped OIDs Christian Couder
2026-11-26 13:57   ` Kaartic Sivaraam
2026-11-26 22:18     ` brian m. carlson
2026-10-23  7:25 ` [PATCH v2 04/13] odb: implement interoperability functions Christian Couder
2026-11-26 15:30   ` Kaartic Sivaraam
2026-10-23  7:25 ` [PATCH v2 05/13] object-file-convert: implement mapping in terms of object DB Christian Couder
2026-11-26 15:37   ` Kaartic Sivaraam
2026-10-23  7:25 ` [PATCH v2 06/13] pack-write: add support for pack index v3 Christian Couder
2026-11-30 16:05   ` Kaartic Sivaraam
2026-10-23  7:25 ` [PATCH v2 07/13] builtin: populate pack index v3 fields when indexing Christian Couder
2026-11-26 21:47   ` Junio C Hamano
2026-11-26 22:27     ` brian m. carlson [this message]
2026-11-26 22:58       ` Junio C Hamano
2026-10-23  7:25 ` [PATCH v2 08/13] object-file: handle compatibility algorithm Christian Couder
2026-10-23  7:25 ` [PATCH v2 09/13] packfile: add support for reading pack index v3 Christian Couder
2026-10-23  7:25 ` [PATCH v2 10/13] packfile: validate pack index v3 tables Christian Couder
2026-10-23  7:25 ` [PATCH v2 11/13] loose: map object IDs using pack index v3 Christian Couder
2026-10-23  7:25 ` [PATCH v2 12/13] packfile: allow looking up compat object IDs in packs Christian Couder
2026-10-23  7:25 ` [PATCH v2 13/13] doc: move pack index v3 documentation Christian Couder
2026-10-23 12:43 ` [PATCH v2 00/13] SHA-1/SHA-256 interoperability, part 3: pack index v3 Ben Knoble
2026-10-23 15:00 ` Junio C Hamano
2026-10-27 12:53   ` Christian Couder

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=awiyY0v5pUnWm-Gd@fruit.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox