git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Tyler CiprianiNext: Tyler Cipriani
Message 5 of 7 in “test-grep-lint is uncomfortably slow”
  1. Junio C HamanoOct 6, 2026
  2. Jeff KingOct 14, 2026
  3. 0/4 t: run greplint checks inside chainlintTyler Cipriani, Oct 25, 2026
  4. 1/4 t/interop: replace bare grep with test_grepTyler Cipriani, Oct 25, 2026
  5. 2/4 t/greplint: skip test bodies without the word grepTyler Cipriani, Oct 25, 2026
  6. 3/4 t/greplint: move parsing and token check to libraryTyler Cipriani, Oct 25, 2026
  7. 4/4 t/chainlint: add --greplint to run greplintTyler Cipriani, Oct 25, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.