Subject: Re: [PATCH v3 4/8] packed-backend: add "packed-refs" header consistency check

From: shejialuo <[email-masked]>
Date: Wed, 12 Feb 2025 18:12:18 +0800

On Wed, Feb 12, 2025 at 10:56:43AM +0100, Patrick Steinhardt wrote:

[snip]

> > diff --git a/t/t0602-reffiles-fsck.sh b/t/t0602-reffiles-fsck.sh
> > index 42c8d4ca1e..da321f16c6 100755
> > --- a/t/t0602-reffiles-fsck.sh
> > +++ b/t/t0602-reffiles-fsck.sh
> > @@ -639,4 +639,29 @@ test_expect_success SYMLINKS 'the filetype of packed-refs should be checked' '
> >  	)
> >  '
> >  
> > +test_expect_success 'packed-refs header should be checked' '
> > +	test_when_finished "rm -rf repo" &&
> > +	git init repo &&
> > +	(
> > +		cd repo &&
> > +		test_commit default &&
> > +
> > +		git refs verify 2>err &&
> > +		test_must_be_empty err &&
> > +
> > +		for bad_header in "# pack-refs wit: peeled fully-peeled sorted " \
> > +				  "# pack-refs with traits: peeled fully-peeled sorted " \
> > +				  "# pack-refs with a: peeled fully-peeled"
> 
> Instead of verifying thrice that we complain about bad header prefixes,
> should we maybe replace two of these with instances where we check a
> packed-refs file _without_ a header and one with capabilities that we
> don't understand?
> 

I think we could add some tests to verify that we won't complain about
above two cases where packed-refs file without a header and one with
capabilities that we don't understand.

> Patrick