public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail•com>
Cc: git@vger•kernel.org,  peff@peff•net,  Derrick Stolee <stolee@gmail•com>
Subject: Re: [PATCH 2/3] t5309: create failing test for 'git index-pack'
Date: Wed, 23 Apr 2025 12:37:17 -0700	[thread overview]
Message-ID: <xmqqfrhyy8ia.fsf@gitster.g> (raw)
In-Reply-To: <a9430447641ff3b3f519abc0960b6741fd7df700.1745430004.git.gitgitgadget@gmail.com> (Derrick Stolee via GitGitGadget's message of "Wed, 23 Apr 2025 17:40:03 +0000")

"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail•com> writes:

> From: Derrick Stolee <stolee@gmail•com>
>
> This new test demonstrates some behavior where a valid packfile is being
> rejected by the Git client due to the order in which it is resolving
> REF_DELTAs.
>
> The thin packfile has a REF_DELTA chain A->B->C where C is not included
> in the packfile. However, the client repository contains both C and B
> already. Thus, 'git index-pack' is able to resolve A before resolving B.

In order to reconstitute A, B is needed (which recipient has), and
in order to reconstitute B, C is needed (which recipient also has).

The index-pack sees delta based on B to recreate A; it should be
able to reconstitute A using B that already exists.

OK.

> When resolving B, it then attempts to resolve any other REF_DELTAs that
> are pointing to B as a base. This "revisits" A and complains as if there
> is a cycle, but it did not actually detect a cycle.

That's interesting.

> +test_expect_failure 'index-pack works with thin pack A->B->C with B on disk' '
> +	git init server &&
> +	(
> +		cd server &&
> +		test_commit_bulk 4
> +	) &&
> +
> +	A=$(git -C server rev-parse HEAD^{tree}) &&
> +	B=$(git -C server rev-parse HEAD~1^{tree}) &&
> +	C=$(git -C server rev-parse HEAD~2^{tree}) &&
> +	git -C server reset --hard HEAD~1 &&
> +
> +	cat >in <<-EOF &&
> +	REF_DELTA $A $B
> +	REF_DELTA $B $C
> +	EOF
> +
> +	test-tool -C server pack-deltas 2 <in >thin.pack &&

This is minor, but I somehow find it easier to follow without the
temporary file, i.e.

	test-tool -C server pack-deltas 2 >thin.pack <<-EOF &&
	REF_DELTA $A $B
	REF_DELTA $B $C
	EOF

> +	git clone "file://$(pwd)/server" client &&

This truly loses A from the resulting "client" repository, but the
history still can reach B and C.

> +	(
> +		cd client &&
> +		git index-pack --fix-thin --stdin <../thin.pack
> +	)
> +'

Makes sense.

  reply	other threads:[~2025-04-23 19:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 17:40 [PATCH 0/3] Fix REF_DELTA chain bug in 'git index-pack' Derrick Stolee via GitGitGadget
2025-04-23 17:40 ` [PATCH 1/3] test-tool: add pack-deltas helper Derrick Stolee via GitGitGadget
2025-04-23 19:26   ` Junio C Hamano
2025-04-23 19:32     ` Derrick Stolee
2025-04-24 19:41   ` Junio C Hamano
2025-04-24 20:06     ` Derrick Stolee
2025-04-24 20:56       ` Junio C Hamano
2025-04-25  4:34   ` Patrick Steinhardt
2025-04-25  9:34     ` Johannes Schindelin
2025-04-25  9:45       ` Patrick Steinhardt
2025-04-25  9:51         ` Johannes Schindelin
2025-04-25 16:27         ` Junio C Hamano
2025-04-28 15:22           ` Derrick Stolee
2025-04-28 16:37             ` Junio C Hamano
2025-04-28 18:59               ` Derrick Stolee
2025-04-28 20:35                 ` Junio C Hamano
2025-04-23 17:40 ` [PATCH 2/3] t5309: create failing test for 'git index-pack' Derrick Stolee via GitGitGadget
2025-04-23 19:37   ` Junio C Hamano [this message]
2025-04-23 17:40 ` [PATCH 3/3] index-pack: allow revisiting REF_DELTA chains Derrick Stolee via GitGitGadget
2025-04-24 21:41   ` Junio C Hamano
2025-04-25  3:49     ` Derrick Stolee
2025-04-28 20:24 ` [PATCH v2 0/3] Fix REF_DELTA chain bug in 'git index-pack' Derrick Stolee via GitGitGadget
2025-04-28 20:24   ` [PATCH v2 1/3] test-tool: add pack-deltas helper Derrick Stolee via GitGitGadget
2025-04-28 20:24   ` [PATCH v2 2/3] t5309: create failing test for 'git index-pack' Derrick Stolee via GitGitGadget
2025-04-28 20:24   ` [PATCH v2 3/3] index-pack: allow revisiting REF_DELTA chains Derrick Stolee via GitGitGadget
2025-05-07  2:08     ` Taylor Blau
2025-05-07 13:47       ` Derrick Stolee
2025-04-28 22:40   ` [PATCH v2 0/3] Fix REF_DELTA chain bug in 'git index-pack' Junio C Hamano
2025-04-29  5:33     ` Patrick Steinhardt

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=xmqqfrhyy8ia.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitgitgadget@gmail$(echo .)com \
    --cc=peff@peff$(echo .)net \
    --cc=stolee@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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