[PATCH 2/4] t/greplint: skip test bodies without the word grep
- From
Tyler Cipriani <tyler@tylercipriani.com>
- Date
- Oct 25, 2026, 06:35 UTC
- Message-ID
- <20261025063508.3026136-3-tyler@tylercipriani.com>
- In-Reply-To
- <20261025063508.3026136-1-tyler@tylercipriani.com>
From: Jeff King <peff@peff.net>
greplint.pl spends time parsing test bodies that cannot contain a bare grep. Check for the string "grep" first and skip the parse when it isn't there. This reduces the cost of "make test-greplint" by ~50%.
Signed-off-by: Tyler Cipriani <tyler@tylercipriani.com> --- t/greplint.pl | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/t/greplint.pl b/t/greplint.pl index 23efe27511..68b6eba78d 100644 --- a/t/greplint.pl +++ b/t/greplint.pl @@ -190,6 +190,15 @@ sub check_test { } } return unless $body; + # We can never match a bare "grep" if there isn't one in the first + # place. So we can skip all of the parsing effort. Technically you + # can have: + # + # gr\ + # ep + # + # but that is sufficiently insane that I think we can ignore it. + return unless $body =~ /grep/; my $raw_lines = $self->{raw_lines};
-- 2.47.3