Subject: Re: [PATCH 1/2] t5332-multi-pack-reuse.sh: demonstrate duplicate packing failure

From: Junio C Hamano <[email-masked]>
Date: Thu, 14 Nov 2024 10:12:15 +0900

Taylor Blau <[email-masked]> 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?

> +		git multi-pack-index write --bitmap --preferred-pack=pack-$p.idx &&
> +
> +		test_pack_objects_reused_all 192 2
> +	)
> +'
> +
>  test_done