Re: [PATCH v1] perf/aggregate: tighten option parsing
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 21, 2018, 03:50 UTC
- Message-ID
- <xmqqd0ytb4le.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <87h8o5ensj.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 16 quoted lines
>> Not necessarily worth a re-roll.
>
> Not that it matters in this case, but just as a bit of Perl rx pedantry,
> yes his is tighter & more correct. You didn't consider how "." interacts
> with newlines:
>
> $ perl -wE 'my @rx = (qr/^--./, qr/^--.+$/, qr/^--./m, qr/^--.+$/m, qr/^--./s, qr/^--.+$/s); for (@rx) { my $s = "--foo\n--bar"; say $_, "\t", ($s =~ $_ ? 1 : 0) }'
> (?^u:^--.) 1
> (?^u:^--.+$) 0
> (?^um:^--.) 1
> (?^um:^--.+$) 1
> (?^us:^--.) 1
> (?^us:^--.+$) 1
>
> I don't think it matters here, not like someone will pass \n in options
> to aggregate.perl...Hmph, do we want the command not to barf when "--foo\n--bar" is given from the command line and we cannot find such an option?
I thought that the location the match under discussion is used does want to see a hit with any option looking string that begins with double dashes. I would have expected "tigher and hence incorrect", in other words.
Somewhat puzzled...