Re: [PATCH 7/9] ls-refs: ignore very long ref-prefix counts
From: Jeff King <hidden>
Date: 2021-09-14 22:09:49
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. The test does work once corrected. And in fact I had originally written it correctly as a "test_seq | sed" pipeline, but generating 64k+ lines in the shell seemed a bit much (we do avoid sub-processes, but the "set -x" output is unwieldy). I'll fix it in a re-roll. -Peff