]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t: fix grep assertions missing file arguments
authorMichael Montalbo <mmontalbo@gmail.com>
Mon, 6 Jul 2026 05:01:54 +0000 (05:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Jul 2026 20:26:01 +0000 (13:26 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2402-worktree-list.sh
t/t7507-commit-verbose.sh
t/t7700-repack.sh

index e0c6abd2f58e206efaa4d58c075d584feb064fda..93f92e854aa829f0af9252f22badeed80d52238d 100755 (executable)
@@ -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' '
index b53d71c0862396cc9a6eabaaad2041e476173a46..acdb6b1455b17e00cadd6c9cd698994516420f10 100755 (executable)
@@ -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
index 63ef63fc509a1db6db7bec96113a6943963177e8..c6ff3aed30b5ddf0a376b25092cefdc30083cb2e 100755 (executable)
@@ -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
 '