@@ -63,7 +63,7 @@ test_expect_success 'setup (initial)' '
6363'
6464test_expect_success ' status works (initial)' '
6565 git add -i </dev/null >output &&
66- grep "+1/-0 *+2/-0 file" output
66+ test_grep "+1/-0 *+2/-0 file" output
6767'
6868
6969test_expect_success ' setup expected' '
@@ -86,7 +86,7 @@ test_expect_success 'revert works (initial)' '
8686 git add file &&
8787 test_write_lines r 1 | git add -i &&
8888 git ls-files >output &&
89- ! grep . output
89+ test_grep ! . output
9090'
9191
9292test_expect_success ' add untracked (multiple)' '
@@ -109,7 +109,7 @@ test_expect_success 'setup (commit)' '
109109'
110110test_expect_success ' status works (commit)' '
111111 git add -i </dev/null >output &&
112- grep "+1/-0 *+2/-0 file" output
112+ test_grep "+1/-0 *+2/-0 file" output
113113'
114114
115115test_expect_success ' update can stage deletions' '
@@ -141,7 +141,7 @@ test_expect_success 'revert works (commit)' '
141141 git add file &&
142142 test_write_lines r 1 | git add -i &&
143143 git add -i </dev/null >output &&
144- grep "unchanged *+3/-0 file" output
144+ test_grep "unchanged *+3/-0 file" output
145145'
146146
147147test_expect_success ' reject multi-key input' '
@@ -185,7 +185,7 @@ test_expect_success 'setup fake editor' '
185185test_expect_success ' bad edit rejected' '
186186 git reset &&
187187 test_write_lines e n d | git add -p >output &&
188- grep "hunk does not apply" output
188+ test_grep "hunk does not apply" output
189189'
190190
191191test_expect_success ' setup patch' '
@@ -198,7 +198,7 @@ test_expect_success 'setup patch' '
198198test_expect_success ' garbage edit rejected' '
199199 git reset &&
200200 test_write_lines e n d | git add -p >output &&
201- grep "hunk does not apply" output
201+ test_grep "hunk does not apply" output
202202'
203203
204204test_expect_success ' setup patch' '
@@ -313,8 +313,8 @@ test_expect_success FILEMODE 'stage mode and hunk' '
313313 chmod +x file &&
314314 printf "y\\ny\\n" | git add -p &&
315315 git diff --cached file >out &&
316- grep "new mode" out &&
317- grep "+content" out &&
316+ test_grep "new mode" out &&
317+ test_grep "+content" out &&
318318 git diff file >out &&
319319 test_must_be_empty out
320320'
@@ -636,7 +636,7 @@ test_expect_success 'split hunk "add -p (edit)"' '
636636 printf "%s\n" s e q n q q |
637637 EDITOR=: git add -p &&
638638 git diff >actual &&
639- ! grep "^+15" actual
639+ test_grep ! "^+15" actual
640640'
641641
642642test_expect_success ' split hunk "add -p (no, yes, edit)"' '
@@ -648,7 +648,7 @@ test_expect_success 'split hunk "add -p (no, yes, edit)"' '
648648 EDITOR=: git add -p 2>error &&
649649 test_must_be_empty error &&
650650 git diff >actual &&
651- ! grep "^+31" actual
651+ test_grep ! "^+31" actual
652652'
653653
654654test_expect_success ' split hunk with incomplete line at end' '
@@ -682,7 +682,7 @@ test_expect_success 'edit, adding lines to the first hunk' '
682682 EDITOR=./fake_editor.sh git add -p 2>error &&
683683 test_must_be_empty error &&
684684 git diff --cached >actual &&
685- grep "^+22" actual
685+ test_grep "^+22" actual
686686'
687687
688688test_expect_success ' patch mode ignores unmerged entries' '
@@ -696,7 +696,7 @@ test_expect_success 'patch mode ignores unmerged entries' '
696696 test_must_fail git merge side &&
697697 echo changed >non-conflict.t &&
698698 echo y | git add -p >output &&
699- ! grep a/conflict.t output &&
699+ test_grep ! a/conflict.t output &&
700700 cat >expected <<-\EOF &&
701701 * Unmerged path conflict.t
702702 diff --git a/non-conflict.t b/non-conflict.t
@@ -728,7 +728,7 @@ test_expect_success 'diffs can be colorized' '
728728
729729 # We do not want to depend on the exact coloring scheme
730730 # git uses for diffs, so just check that we saw some kind of color.
731- grep "$(printf "\\033")" output
731+ test_grep "$(printf "\\033")" output
732732'
733733
734734test_expect_success ' colors can be overridden' '
@@ -743,7 +743,7 @@ test_expect_success 'colors can be overridden' '
743743 -c color.interactive.error=blue \
744744 add -i 2>err.raw <input &&
745745 test_decode_color <err.raw >err &&
746- grep "<BLUE>Huh (trigger)?<RESET>" err &&
746+ test_grep "<BLUE>Huh (trigger)?<RESET>" err &&
747747
748748 test_write_lines help quit >input &&
749749 force_color git \
@@ -863,7 +863,7 @@ test_expect_success 'colorized diffs respect diff.wsErrorHighlight' '
863863 printf y >y &&
864864 force_color git -c diff.wsErrorHighlight=all add -p >output.raw 2>&1 <y &&
865865 test_decode_color <output.raw >output &&
866- grep "old<" output
866+ test_grep "old<" output
867867'
868868
869869test_expect_success ' diffFilter filters diff' '
@@ -876,7 +876,7 @@ test_expect_success 'diffFilter filters diff' '
876876
877877 # avoid depending on the exact coloring or content of the prompts,
878878 # and just make sure we saw our diff prefixed
879- grep foo:.*content output
879+ test_grep foo:.*content output
880880'
881881
882882test_expect_success ' detect bogus diffFilter output' '
@@ -886,7 +886,7 @@ test_expect_success 'detect bogus diffFilter output' '
886886 test_config interactive.diffFilter "sed 6d" &&
887887 printf y >y &&
888888 force_color test_must_fail git add -p <y >output 2>&1 &&
889- grep "mismatched output" output
889+ test_grep "mismatched output" output
890890'
891891
892892test_expect_success ' handle iffy colored hunk headers' '
@@ -896,7 +896,7 @@ test_expect_success 'handle iffy colored hunk headers' '
896896 printf n >n &&
897897 force_color git -c interactive.diffFilter="sed s/.*@@.*/XX/" \
898898 add -p >output 2>&1 <n &&
899- grep "^XX$" output
899+ test_grep "^XX$" output
900900'
901901
902902test_expect_success ' handle very large filtered diff' '
@@ -1002,7 +1002,7 @@ test_expect_success 'add -p does not expand argument lists' '
10021002 # update it, but we want to be sure that our "." pathspec
10031003 # was not expanded into the argument list of any command.
10041004 # So look only for "not-changed".
1005- ! grep -E "^trace: (built-in|exec|run_command): .*not-changed" trace.out
1005+ test_grep ! -E "^trace: (built-in|exec|run_command): .*not-changed" trace.out
10061006'
10071007
10081008test_expect_success ' hunk-editing handles custom comment char' '
@@ -1072,21 +1072,21 @@ test_expect_success 'setup different kinds of dirty submodules' '
10721072
10731073test_expect_success ' status ignores dirty submodules (except HEAD)' '
10741074 git -C for-submodules add -i </dev/null >output &&
1075- grep dirty-head output &&
1076- grep dirty-both-ways output &&
1077- ! grep dirty-otherwise output
1075+ test_grep dirty-head output &&
1076+ test_grep dirty-both-ways output &&
1077+ test_grep ! dirty-otherwise output
10781078'
10791079
10801080test_expect_success ' handle submodules' '
10811081 echo 123 >>for-submodules/dirty-otherwise/initial.t &&
10821082
10831083 force_color git -C for-submodules add -p dirty-otherwise >output 2>&1 &&
1084- grep "No changes" output &&
1084+ test_grep "No changes" output &&
10851085
10861086 force_color git -C for-submodules add -p dirty-head >output 2>&1 <y &&
10871087 git -C for-submodules ls-files --stage dirty-head >actual &&
10881088 rev="$(git -C for-submodules/dirty-head rev-parse HEAD)" &&
1089- grep "$rev" actual
1089+ test_grep "$rev" actual
10901090'
10911091
10921092test_expect_success ' set up pathological context' '
0 commit comments