Subject: Re: [PATCH v4 9/9] pack-bitmap.c: gracefully fallback after opening pack/MIDX

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Wed, 26 Jan 2022 16:08:07 +0100

On Tue, Jan 25 2022, Taylor Blau wrote:

> diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
> index d05ab716f6..f775fc1ce6 100755
> --- a/t/t5310-pack-bitmaps.sh
> +++ b/t/t5310-pack-bitmaps.sh
> @@ -397,4 +397,32 @@ test_expect_success 'pack.preferBitmapTips' '
>  	)
>  '
>  
> +test_expect_success 'complains about multiple pack bitmaps' '
> +	rm -fr repo &&
> +	git init repo &&
> +	test_when_finished "rm -fr repo" &&

Nit: the "rm -rf" isn't needed per the comment on 1/9...

> +	(
> +		cd repo &&
> +
> +		test_commit base &&
> +
> +		git repack -adb &&
> +		bitmap="$(ls .git/objects/pack/pack-*.bitmap)" &&
> +		mv "$bitmap" "$bitmap.bak" &&
> +
> +		test_commit other &&
> +		git repack -ab &&
> +
> +		mv "$bitmap.bak" "$bitmap" &&
> +
> +		find .git/objects/pack -type f -name "*.pack" >packs &&
> +		find .git/objects/pack -type f -name "*.bitmap" >bitmaps &&
> +		test_line_count = 2 packs &&
> +		test_line_count = 2 bitmaps &&
> +
> +		git rev-list --use-bitmap-index HEAD 2>err &&
> +		grep "ignoring extra bitmap file" err
> +	)
> +'
> +
>  test_done
> diff --git a/t/t5326-multi-pack-bitmaps.sh b/t/t5326-multi-pack-bitmaps.sh
> index c0924074c4..3c1ecc7e25 100755
> --- a/t/t5326-multi-pack-bitmaps.sh
> +++ b/t/t5326-multi-pack-bitmaps.sh
> @@ -266,4 +266,23 @@ test_expect_success 'hash-cache values are propagated from pack bitmaps' '
>  	)
>  '
>  
> +test_expect_success 'graceful fallback when missing reverse index' '
> +	rm -fr repo &&
> +	git init repo &&
> +	test_when_finished "rm -fr repo" &&
> +	(

...and here either, where we're adding a new test to the same file.