Subject: Re: [PATCH 7/9] ls-refs: ignore very long ref-prefix counts

From: Taylor Blau <[email-masked]>
Date: Tue, 14 Sep 2021 18:11:32 -0400

On Tue, Sep 14, 2021 at 06:09:45PM -0400, Jeff King wrote:
> On Tue, Sep 14, 2021 at 11:37:06AM -0400, Jeff King wrote:
>
> > +test_expect_success 'ignore very large set of prefixes' '
> > +	# generate a large number of ref-prefixes that we expect
> > +	# to match nothing; the value here exceeds MAX_ALLOWED_PREFIXES
> > +	# from ls-refs.c.
> > +	{
> > +		echo command=ls-refs &&
> > +		echo object-format=$(test_oid algo)
> > +		echo 0001 &&
> > +		perl -le "print \"refs/heads/$_\" for (1..65536+1)" &&
> > +		echo 0000
> > +	} |
> > +	test-tool pkt-line pack >in &&
>
> Yuck. While double-checking some refactoring, I realized this test does
> not actually generate the correct input!
>
> It omits the "ref-prefix" header. _And_ it accidentally expands $_ in
> the shell rather than in perl.

Hah, nice find. You'd think that one of us would have caught it earlier
given that we both discussed it.

Thanks,
Taylor