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

[PATCH v4 2/6] t: fix grep assertions missing file arguments

From
Michael Montalbo via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 6, 2026, 05:01 UTC
Message-ID
<44ba6d1f1a549f34f73f3863c035837403271f35.1783314119.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2135.v4.git.1783314119.gitgitgadget@gmail.com>
From: Michael Montalbo <mmontalbo@gmail.com>

Three grep assertions were missing their file arguments, causing them to read from empty stdin instead of the intended file:

- t2402: '! grep ...' should read from 'out', matching the
  grep on the preceding line.
- t7507: the closing quote is in the wrong place, making the
  entire 'diff --git actual' a single pattern with no file
  argument instead of pattern 'diff --git' and file 'actual'.
- t7700: '! grep ...' should read from 'packlist', matching
  the redirect on the preceding line.

Without file arguments these greps always succeed (empty stdin matches nothing), so the assertions were not actually checking anything. All three tests pass with the corrected file arguments, confirming the intended behavior is sound.

Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>
---
 t/t2402-worktree-list.sh  | 2 +-
 t/t7507-commit-verbose.sh | 2 +-
 t/t7700-repack.sh         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/t2402-worktree-list.sh b/t/t2402-worktree-list.sh
index e0c6abd2f5..93f92e854a 100755
--- a/t/t2402-worktree-list.sh
+++ b/t/t2402-worktree-list.sh
@@ -144,7 +144,7 @@ test_expect_success '"list" all worktrees with prunable annotation' '
 	rm -rf prunable &&
 	git worktree list >out &&
 	grep "/prunable  *[0-9a-f].* prunable$" out &&
-	! grep "/unprunable  *[0-9a-f].* prunable$"
+	! grep "/unprunable  *[0-9a-f].* prunable$" out
 '
 
 test_expect_success '"list" all worktrees --porcelain with prunable' '
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index b53d71c086..acdb6b1455 100755
--- a/t/t7507-commit-verbose.sh
+++ b/t/t7507-commit-verbose.sh
@@ -163,7 +163,7 @@ done
 
 test_expect_success "status ignores commit.verbose=true" '
 	git -c commit.verbose=true status >actual &&
-	! grep "^diff --git actual"
+	! grep "^diff --git" actual
 '
 
 test_done
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index 63ef63fc50..c6ff3aed30 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -194,7 +194,7 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar
 	rm -f .git/objects/pack/* &&
 	mv pack-* .git/objects/pack/ &&
 	git verify-pack -v -- .git/objects/pack/*.idx >packlist &&
-	! grep "^$coid " &&
+	! grep "^$coid " packlist &&
 	echo >.git/objects/info/alternates &&
 	test_must_fail git show $coid
 '
-- 
gitgitgadget
Previous: Michael Montalbo via GitGitGadgetNext: Michael Montalbo via GitGitGadget
Message 36 of 40 in “t: add lint-style.pl and convert grep to test_grep”
  1. 0/6 t: add lint-style.pl and convert grep to test_grepMichael Montalbo via GitGitGadget, Jun 4, 2026
  2. 1/6 t/README: document test_grep helperMichael Montalbo via GitGitGadget, Jun 4, 2026
  3. 3/6 t: fix Lexer line count for $() inside double-quoted stringsMichael Montalbo via GitGitGadget, Jun 4, 2026
  4. 2/6 t: extract chainlint's parser into shared moduleMichael Montalbo via GitGitGadget, Jun 4, 2026
  5. 4/6 t: add lint-style.pl with test_grep negation ruleMichael Montalbo via GitGitGadget, Jun 4, 2026
  6. D. Ben KnobleJun 4, 2026
  7. Michael MontalboJun 4, 2026
  8. 5/6 t: fix grep assertions missing file argumentsMichael Montalbo via GitGitGadget, Jun 4, 2026
  9. 6/6 t: lint and convert grep assertions to test_grepMichael Montalbo via GitGitGadget, Jun 4, 2026
  10. Junio C HamanoJun 8, 2026
  11. Michael MontalboJun 13, 2026
  12. 0/6 t: add greplint.pl and convert grep to test_grepMichael Montalbo via GitGitGadget, Jun 13, 2026
  13. 1/6 t/README: document test_grep helperMichael Montalbo via GitGitGadget, Jun 13, 2026
  14. 2/6 t: fix grep assertions missing file argumentsMichael Montalbo via GitGitGadget, Jun 13, 2026
  15. 3/6 t: extract chainlint's parser into shared moduleMichael Montalbo via GitGitGadget, Jun 13, 2026
  16. 4/6 t: fix Lexer line count for $() inside double-quoted stringsMichael Montalbo via GitGitGadget, Jun 13, 2026
  17. 5/6 t: convert grep assertions to test_grepMichael Montalbo via GitGitGadget, Jun 13, 2026
  18. SZEDER GáborJun 27, 2026
  19. Junio C HamanoJun 27, 2026
  20. Junio C HamanoJun 28, 2026
  21. Junio C HamanoJun 28, 2026
  22. Junio C HamanoJun 29, 2026
  23. Michael MontalboJul 2, 2026
  24. 6/6 t: add greplint to detect bare grep assertionsMichael Montalbo via GitGitGadget, Jun 13, 2026
  25. 0/6 t: add greplint.pl and convert grep to test_grepMichael Montalbo via GitGitGadget, Jul 3, 2026
  26. 1/6 t/README: document test_grep helperMichael Montalbo via GitGitGadget, Jul 3, 2026
  27. 2/6 t: fix grep assertions missing file argumentsMichael Montalbo via GitGitGadget, Jul 3, 2026
  28. 3/6 t: extract chainlint's parser into shared moduleMichael Montalbo via GitGitGadget, Jul 3, 2026
  29. 4/6 t: fix Lexer line count for $() inside double-quoted stringsMichael Montalbo via GitGitGadget, Jul 3, 2026
  30. 6/6 t: add greplint to detect bare grep assertionsMichael Montalbo via GitGitGadget, Jul 3, 2026
  31. 5/6 t: convert grep assertions to test_grepMichael Montalbo via GitGitGadget, Jul 3, 2026
  32. Junio C HamanoJul 5, 2026
  33. Michael MontalboJul 5, 2026
  34. 0/6 t: add greplint.pl and convert grep to test_grepMichael Montalbo via GitGitGadget, Jul 6, 2026
  35. 1/6 t/README: document test_grep helperMichael Montalbo via GitGitGadget, Jul 6, 2026
  36. 2/6 t: fix grep assertions missing file argumentsMichael Montalbo via GitGitGadget, Jul 6, 2026
  37. 3/6 t: extract chainlint's parser into shared moduleMichael Montalbo via GitGitGadget, Jul 6, 2026
  38. 4/6 t: fix Lexer line count for $() inside double-quoted stringsMichael Montalbo via GitGitGadget, Jul 6, 2026
  39. 6/6 t: add greplint to detect bare grep assertionsMichael Montalbo via GitGitGadget, Jul 6, 2026
  40. 5/6 t: convert grep assertions to test_grepMichael Montalbo via GitGitGadget, Jul 6, 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.