git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH 1/2] t5332-multi-pack-reuse.sh: demonstrate duplicate packing failure
Date: Thu, 14 Nov 2024 08:37:10 -0500	[thread overview]
Message-ID: <ZzX9BgmxTgi6Pk8z@nand.local> (raw)
In-Reply-To: <xmqq8qtm8vps.fsf@gitster.g>

On Thu, Nov 14, 2024 at 10:12:15AM +0900, Junio C Hamano wrote:
> Taylor Blau <me@ttaylorr.com> writes:
>
> > +test_expect_failure 'duplicate objects with verbatim reuse' '
> > +	git init duplicate-objects-verbatim &&
> > +	(
> > +		cd duplicate-objects-verbatim &&
> > +
> > +		git config pack.allowPackReuse multi &&
> > +
> > +		test_commit_bulk 64 &&
> > +
> > +		# take the first object from the main pack...
> > +		git show-index <$(ls $packdir/pack-*.idx) >obj.raw &&
> > +		sort -nk1 <obj.raw | head -n1 | cut -d" " -f2 >in &&
> > +
> > +		# ...and create a separate pack containing just that object
> > +		p="$(git pack-objects $packdir/pack <in)" &&
> > +		git show-index <$packdir/pack-$p.idx &&
>
> Is this done so that "git show-index" fails when the .idx file fed
> is malformed?  Or is it a leftover debugging aid, where a human
> developer was helped by eyeballing the contents of the .idx file in
> human readable form?  If the latter, do we perhaps want to "parse"
> the output the same way in this test to validate our expectation?

Oops. This is stray debugging left over that I forgot to take out before
committing. That makes it the latter of the two you mentioned, but I
don't think we need to validate the output of 'git show-index' in this
instance.

We're just relying on pack-objects to generate a pack containing a
single object, which feels like basic functionality not worth explicitly
making an assertion on.

There is a subtle assertion on the line below here:

> > +		git multi-pack-index write --bitmap --preferred-pack=pack-$p.idx &&

that the pack (a) exists, and (b) has at least one object, since both
conditions must be met for a pack to become preferred in a MIDX bitmap.

But beyond that, I don't think we need to validate the output of
show-index here. I'll remove the stray debugging line and send a new
round. Sorry about that, and thanks for spotting!

Thanks,
Taylor

  reply	other threads:[~2024-11-14 13:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13 17:32 [PATCH 0/2] pack-objects: more brown-paper-bag multi-pack reuse fixes Taylor Blau
2024-11-13 17:32 ` [PATCH 1/2] t5332-multi-pack-reuse.sh: demonstrate duplicate packing failure Taylor Blau
2024-11-14  1:12   ` Junio C Hamano
2024-11-14 13:37     ` Taylor Blau [this message]
2024-11-13 17:32 ` [PATCH 2/2] pack-objects: only perform verbatim reuse on the preferred pack Taylor Blau
2024-11-14  0:25   ` Jeff King
2024-11-14 13:40     ` Taylor Blau
2024-11-15  9:57       ` Jeff King
2024-11-22  9:16       ` Kristoffer Haugsbakk
2024-11-14 13:42 ` [PATCH v2 0/2] pack-objects: more brown-paper-bag multi-pack reuse fixes Taylor Blau
2024-11-14 13:42   ` [PATCH v2 1/2] t5332-multi-pack-reuse.sh: demonstrate duplicate packing failure Taylor Blau
2024-11-14 13:42   ` [PATCH v2 2/2] pack-objects: only perform verbatim reuse on the preferred pack Taylor Blau
2024-11-22  4:44     ` Junio C Hamano
2024-11-22  8:33       ` Jeff King

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=ZzX9BgmxTgi6Pk8z@nand.local \
    --to=me@ttaylorr.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    /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;
as well as URLs for NNTP newsgroup(s).