t: convert grep assertions to test_grep

Replace bare grep with test_grep in test assertions across the suite, including sourced test helpers (lib-*.sh, *-tests.sh). test_grep prints the contents of the file being searched on failure, making debugging easier than a bare grep which fails silently. Only assertion-style greps are converted: grep used as a filter in pipelines, command substitutions, conditionals, or with redirected I/O is left as-is with a "# lint-ok" annotation. Existing '! test_grep' calls are rewritten to 'test_grep !' so that the diagnostic output is preserved on failure. test_grep requires the file it reads to exist, so '! grep' assertions that inspect a file whose presence is conditional need care. In t5537 the '.git/shallow' file is still present after the repack (the client remains shallow), so the assertion is converted like any other. In t1400 the '.git/packed-refs' file exists only with the files backend, so its check is guarded with a REFFILES prerequisite; the backend-agnostic 'git show-ref' check that follows still runs under every backend. In t7450 'git~2' is the NTFS 8.3 short name of a '..git' file and only exists when 8.3 short-name generation is enabled, so its check is guarded with a 'test -f' on the path and uses test_grep inside the guard, the same shape as t1400 (a plain test_grep would BUG when the short name is absent). The conversion was generated using a grep-assertion linter (greplint.pl, added in the following commit) to identify bare grep calls at command position. To reproduce, from the t/ directory: # Step 1: annotate the two data-filter greps (grep produces # data, not a verdict) so the linter skips them. sed -i '/grep -vf before commits\.raw/s/$/ # lint-ok: data filter/' \ t5326-multi-pack-bitmaps.sh sed -i '/grep -E "^\[0-9a-f\].*|| :/s/$/ # lint-ok: data filter/' \ t5702-protocol-v2.sh # Step 1b: two '! grep' assertions need more than a mechanical # conversion; handle them by hand before the linter-driven steps # below so it leaves them alone. # # t1400: '.git/packed-refs' is absent under reftable, so guard the # check with REFFILES (a plain test_grep would BUG on the missing # file): # # git update-ref -d HEAD $B && # - ! grep "$m" .git/packed-refs && # + if test_have_prereq REFFILES # + then # + test_grep ! "$m" .git/packed-refs # + fi && # test_must_fail git show-ref --verify -q $m # # t7450: git~2 is an NTFS 8.3 short name that exists only when # short-name generation is enabled, so guard the check on its # presence with 'test -f' and note in a comment why the path can # be absent (a plain test_grep would BUG when it is): # # - ! grep gitdir squatting-clone/d/a/git~2 # + if test -f squatting-clone/d/a/git~2 # + then # + test_grep ! gitdir squatting-clone/d/a/git~2 # + fi # Step 2: reorder pre-existing '! test_grep' to 'test_grep !' # (must come before steps 3-4 so greplint does not see them) sed -i 's/! test_grep/test_grep !/' t0031-lockfile-pid.sh sed -i 's/! test_grep/test_grep !/' t5300-pack-object.sh sed -i 's/! test_grep/test_grep !/' t5319-multi-pack-index.sh # Step 3: convert '! grep' -> 'test_grep !' perl greplint.pl *.sh 2>&1 | cut -d: -f1,2 | while IFS=: read f l; do sed -i "${l}s/! *grep/test_grep !/" "$f" done # Step 4: convert remaining 'grep' -> 'test_grep' perl greplint.pl *.sh 2>&1 | cut -d: -f1,2 | while IFS=: read f l; do sed -i "${l}s/grep/test_grep/" "$f" done To verify, run: make -C t test-greplint Signed-off-by: Michael Montalbo <mmontalbo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Montalbo committed Jul 6, 2026 at 05:01 UTC 47f79f619834acdd39d39bd1d3b33bf57f80d0a2
338 files changed +2815 -2806
t/for-each-ref-tests.sh
+6 -6
@@ -523,7 +523,7 @@ test_expect_success 'Verify descending sort' '
523
524 test_expect_success 'Give help even with invalid sort atoms' '
525 test_expect_code 129 ${git_for_each_ref} --sort=bogus -h >actual 2>&1 &&
526 - grep "^usage: ${git_for_each_ref}" actual
526 + test_grep "^usage: ${git_for_each_ref}" actual
527 '
528
529 cat >expected <<\EOF
@@ -622,7 +622,7 @@ test_expect_success 'Quoting style: tcl' '
622 for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do
623 test_expect_success "more than one quoting style: $i" "
624 test_must_fail ${git_for_each_ref} $i 2>err &&
625 - grep '^error: more than one quoting style' err
625 + test_grep '^error: more than one quoting style' err
626 "
627 done
628
@@ -1892,7 +1892,7 @@ test_expect_success "${git_for_each_ref} --stdin: fails if extra args" '
1892 >in &&
1893 test_must_fail ${git_for_each_ref} --format="%(refname)" \
1894 --stdin refs/heads/extra <in 2>err &&
1895 - grep "unknown arguments supplied with --stdin" err
1895 + test_grep "unknown arguments supplied with --stdin" err
1896 '
1897
1898 test_expect_success "${git_for_each_ref} --stdin: matches" '
@@ -1955,11 +1955,11 @@ test_expect_success "${git_for_each_ref} with nested tags" '
1955
1956 test_expect_success 'is-base atom with non-commits' '
1957 ${git_for_each_ref} --format="%(is-base:HEAD) %(refname)" >out 2>err &&
1958 - grep "(HEAD) refs/heads/main" out &&
1958 + test_grep "(HEAD) refs/heads/main" out &&
1959
1960 test_line_count = 2 err &&
1961 - grep "error: object .* is a commit, not a blob" err &&
1962 - grep "error: bad tag pointer to" err
1961 + test_grep "error: object .* is a commit, not a blob" err &&
1962 + test_grep "error: bad tag pointer to" err
1963 '
1964
1965 GRADE_FORMAT="%(signature:grade)%0a%(signature:key)%0a%(signature:signer)%0a%(signature:fingerprint)%0a%(signature:primarykeyfingerprint)"
t/lib-bitmap.sh
+6 -6
@@ -173,7 +173,7 @@ rev_list_tests_head () {
173
174 test_expect_success "bitmap --objects handles non-commit objects ($state, $branch)" '
175 git rev-list --objects --use-bitmap-index $branch tagged-blob >actual &&
176 - grep $blob actual
176 + test_grep $blob actual
177 '
178 }
179
@@ -242,16 +242,16 @@ basic_bitmap_tests () {
242 GIT_PROGRESS_DELAY=0 \
243 git pack-objects --all --stdout --progress \
244 </dev/null >/dev/null 2>stderr &&
245 - grep "Enumerating objects: $count, done" stderr &&
246 - grep "pack-reused $count" stderr &&
245 + test_grep "Enumerating objects: $count, done" stderr &&
246 + test_grep "pack-reused $count" stderr &&
247
248 # now the same but with one non-reused object
249 git commit --allow-empty -m "an extra commit object" &&
250 GIT_PROGRESS_DELAY=0 \
251 git pack-objects --all --stdout --progress \
252 </dev/null >/dev/null 2>stderr &&
253 - grep "Enumerating objects: $((count+1)), done" stderr &&
254 - grep "pack-reused $count" stderr
253 + test_grep "Enumerating objects: $((count+1)), done" stderr &&
254 + test_grep "pack-reused $count" stderr
255 '
256 }
257
@@ -283,7 +283,7 @@ test_rev_exists () {
283 then
284 test_path_is_file $midx-$(midx_checksum $objdir).rev
285 fi &&
286 - grep "\"category\":\"load_midx_revindex\",\"key\":\"source\",\"value\":\"$kind\"" event.trace
286 + test_grep "\"category\":\"load_midx_revindex\",\"key\":\"source\",\"value\":\"$kind\"" event.trace
287 '
288 }
289
t/lib-bundle-uri-protocol.sh
+13 -13
@@ -63,9 +63,9 @@ test_expect_success "connect with $BUNDLE_URI_PROTOCOL:// using protocol v2: no
63 >actual 2>err &&
64
65 # Server responded using protocol v2
66 - grep "< version 2" log &&
66 + test_grep "< version 2" log &&
67
68 - ! grep bundle-uri log
68 + test_grep ! bundle-uri log
69 '
70
71 test_expect_success "connect with $BUNDLE_URI_PROTOCOL:// using protocol v2: have bundle-uri" '
@@ -78,10 +78,10 @@ test_expect_success "connect with $BUNDLE_URI_PROTOCOL:// using protocol v2: hav
78 >actual 2>err &&
79
80 # Server responded using protocol v2
81 - grep "< version 2" log &&
81 + test_grep "< version 2" log &&
82
83 # Server advertised bundle-uri capability
84 - grep "< bundle-uri" log
84 + test_grep "< bundle-uri" log
85 '
86
87 test_expect_success "clone with $BUNDLE_URI_PROTOCOL:// using protocol v2: request bundle-uris" '
@@ -95,13 +95,13 @@ test_expect_success "clone with $BUNDLE_URI_PROTOCOL:// using protocol v2: reque
95 >actual 2>err &&
96
97 # Server responded using protocol v2
98 - grep "< version 2" log &&
98 + test_grep "< version 2" log &&
99
100 # Server advertised bundle-uri capability
101 - grep "< bundle-uri" log &&
101 + test_grep "< bundle-uri" log &&
102
103 # Client did not issue bundle-uri command
104 - ! grep "> command=bundle-uri" log &&
104 + test_grep ! "> command=bundle-uri" log &&
105
106 GIT_TRACE_PACKET="$PWD/log" \
107 git \
@@ -111,13 +111,13 @@ test_expect_success "clone with $BUNDLE_URI_PROTOCOL:// using protocol v2: reque
111 >actual 2>err &&
112
113 # Server responded using protocol v2
114 - grep "< version 2" log &&
114 + test_grep "< version 2" log &&
115
116 # Server advertised bundle-uri capability
117 - grep "< bundle-uri" log &&
117 + test_grep "< bundle-uri" log &&
118
119 # Client issued bundle-uri command
120 - grep "> command=bundle-uri" log &&
120 + test_grep "> command=bundle-uri" log &&
121
122 GIT_TRACE_PACKET="$PWD/log3" \
123 git \
@@ -128,13 +128,13 @@ test_expect_success "clone with $BUNDLE_URI_PROTOCOL:// using protocol v2: reque
128 >actual 2>err &&
129
130 # Server responded using protocol v2
131 - grep "< version 2" log3 &&
131 + test_grep "< version 2" log3 &&
132
133 # Server advertised bundle-uri capability
134 - grep "< bundle-uri" log3 &&
134 + test_grep "< bundle-uri" log3 &&
135
136 # Client did not issue bundle-uri command (--bundle-uri override)
137 - ! grep "> command=bundle-uri" log3
137 + test_grep ! "> command=bundle-uri" log3
138 '
139
140 # The remaining tests will all assume transfer.bundleURI=true
t/lib-httpd.sh
+1 -1
@@ -275,7 +275,7 @@ test_http_push_nonff () {
275 '
276
277 test_expect_success 'non-fast-forward push show ref status' '
278 - grep "^ ! \[rejected\][ ]*$BRANCH -> $BRANCH (non-fast-forward)$" output
278 + test_grep "^ ! \[rejected\][ ]*$BRANCH -> $BRANCH (non-fast-forward)$" output
279 '
280
281 test_expect_success 'non-fast-forward push shows help message' '
t/pack-refs-tests.sh
+1 -1
@@ -195,7 +195,7 @@ test_expect_success 'delete ref while another dangling packed ref' '
195 test_expect_success 'pack ref directly below refs/' '
196 git update-ref refs/top HEAD &&
197 git ${pack_refs} --all --prune &&
198 - grep refs/top .git/packed-refs &&
198 + test_grep refs/top .git/packed-refs &&
199 test_path_is_missing .git/refs/top
200 '
201
t/show-ref-exists-tests.sh
+1 -1
@@ -19,7 +19,7 @@ test_expect_success '--exists with missing reference' '
19
20 test_expect_success '--exists does not use DWIM' '
21 test_expect_code 2 ${git_show_ref_exists} $GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 2>err &&
22 - grep "reference does not exist" err
22 + test_grep "reference does not exist" err
23 '
24
25 test_expect_success '--exists with HEAD' '
t/t0000-basic.sh
+8 -8
@@ -743,7 +743,7 @@ test_expect_success 'subtest: lazy prereqs do not turn off tracing' '
743 test_done
744 EOF
745
746 - grep "echo trace" lazy-prereq-and-tracing/err
746 + test_grep "echo trace" lazy-prereq-and-tracing/err
747 '
748
749 test_expect_success 'subtest: tests clean up after themselves' '
@@ -815,7 +815,7 @@ test_expect_success 'subtest: test_atexit is run' '
815
816 test_expect_success 'test_oid provides sane info by default' '
817 test_oid zero >actual &&
818 - grep "^00*\$" actual &&
818 + test_grep "^00*\$" actual &&
819 rawsz="$(test_oid rawsz)" &&
820 hexsz="$(test_oid hexsz)" &&
821 # +1 accounts for the trailing newline
@@ -827,7 +827,7 @@ test_expect_success 'test_oid can look up data for SHA-1' '
827 test_when_finished "test_detect_hash" &&
828 test_set_hash sha1 &&
829 test_oid zero >actual &&
830 - grep "^00*\$" actual &&
830 + test_grep "^00*\$" actual &&
831 rawsz="$(test_oid rawsz)" &&
832 hexsz="$(test_oid hexsz)" &&
833 test $(wc -c <actual) -eq 41 &&
@@ -839,7 +839,7 @@ test_expect_success 'test_oid can look up data for SHA-256' '
839 test_when_finished "test_detect_hash" &&
840 test_set_hash sha256 &&
841 test_oid zero >actual &&
842 - grep "^00*\$" actual &&
842 + test_grep "^00*\$" actual &&
843 rawsz="$(test_oid rawsz)" &&
844 hexsz="$(test_oid hexsz)" &&
845 test $(wc -c <actual) -eq 65 &&
@@ -884,11 +884,11 @@ test_expect_success 'test_bool_env' '
884 # test script, hence the redirection of fd 7, and aborts
885 # with "exit 1", hence the subshell.
886 ! ( test_bool_env envvar true ) 7>err &&
887 - grep "error: test_bool_env requires bool values" err &&
887 + test_grep "error: test_bool_env requires bool values" err &&
888
889 envvar=true &&
890 ! ( test_bool_env envvar invalid ) 7>err &&
891 - grep "error: test_bool_env requires bool values" err
891 + test_grep "error: test_bool_env requires bool values" err
892 )
893 '
894
@@ -1242,12 +1242,12 @@ test_expect_success 'test_must_fail on a failing git command with env' '
1242
1243 test_expect_success 'test_must_fail rejects a non-git command' '
1244 ! test_must_fail grep ^$ notafile 2>err &&
1245 - grep -F "test_must_fail: only '"'"'git'"'"' is allowed" err
1245 + test_grep -F "test_must_fail: only '"'"'git'"'"' is allowed" err
1246 '
1247
1248 test_expect_success 'test_must_fail rejects a non-git command with env' '
1249 ! test_must_fail env var1=a var2=b grep ^$ notafile 2>err &&
1250 - grep -F "test_must_fail: only '"'"'git'"'"' is allowed" err
1250 + test_grep -F "test_must_fail: only '"'"'git'"'"' is allowed" err
1251 '
1252
1253 test_done
t/t0001-init.sh
+9 -9
@@ -278,9 +278,9 @@ test_expect_success POSIXPERM 'init creates a new deep directory (umask vs. shar
278 git init --bare --shared=0660 newdir/a/b/c &&
279 test_path_is_dir newdir/a/b/c/refs &&
280 ls -ld newdir/a newdir/a/b > lsab.out &&
281 - ! grep -v "^drwxrw[sx]r-x" lsab.out &&
281 + test_grep ! -v "^drwxrw[sx]r-x" lsab.out &&
282 ls -ld newdir/a/b/c > lsc.out &&
283 - ! grep -v "^drwxrw[sx]---" lsc.out
283 + test_grep ! -v "^drwxrw[sx]---" lsc.out
284 )
285 '
286
@@ -619,7 +619,7 @@ test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage is not allowed wi
619 git init refstorage &&
620 git -C refstorage config extensions.refStorage files &&
621 test_must_fail git -C refstorage rev-parse 2>err &&
622 - grep "repo version is 0, but v1-only extension found" err
622 + test_grep "repo version is 0, but v1-only extension found" err
623 '
624
625 test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with files backend' '
@@ -637,7 +637,7 @@ test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with unknown back
637 git -C refstorage config core.repositoryformatversion 1 &&
638 git -C refstorage config extensions.refStorage garbage &&
639 test_must_fail git -C refstorage rev-parse 2>err &&
640 - grep "invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}garbage${SQ}" err
640 + test_grep "invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}garbage${SQ}" err
641 '
642
643 test_expect_success 'init with GIT_DEFAULT_REF_FORMAT=garbage' '
@@ -848,8 +848,8 @@ test_expect_success MINGW 'redirect std handles' '
848 GIT_REDIRECT_STDOUT=output.txt \
849 GIT_REDIRECT_STDERR="2>&1" \
850 git rev-parse --git-dir --verify refs/invalid &&
851 - grep "^\\.git\$" output.txt &&
852 - grep "Needed a single revision" output.txt
851 + test_grep "^\\.git\$" output.txt &&
852 + test_grep "Needed a single revision" output.txt
853 '
854
855 test_expect_success '--initial-branch' '
@@ -862,14 +862,14 @@ test_expect_success '--initial-branch' '
862 git init --initial-branch=ignore initial-branch-option 2>err &&
863 test_grep "ignored --initial-branch" err &&
864 git -C initial-branch-option symbolic-ref HEAD >actual &&
865 - grep hello actual
865 + test_grep hello actual
866 '
867
868 test_expect_success 'overridden default initial branch name (config)' '
869 test_config_global init.defaultBranch nmb &&
870 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= git init initial-branch-config &&
871 git -C initial-branch-config symbolic-ref HEAD >actual &&
872 - grep nmb actual
872 + test_grep nmb actual
873 '
874
875 test_expect_success 'advice on unconfigured init.defaultBranch' '
@@ -907,7 +907,7 @@ test_expect_success 'overridden default main branch name (env)' '
907 test_config_global init.defaultBranch nmb &&
908 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=env git init main-branch-env &&
909 git -C main-branch-env symbolic-ref HEAD >actual &&
910 - grep env actual
910 + test_grep env actual
911 '
912
913 test_expect_success 'invalid default branch name' '
t/t0008-ignores.sh
+4 -4
@@ -790,8 +790,8 @@ test_expect_success 'existing file and directory' '
790 >one &&
791 mkdir top-level-dir &&
792 git check-ignore one top-level-dir >actual &&
793 - grep one actual &&
794 - grep top-level-dir actual
793 + test_grep one actual &&
794 + test_grep top-level-dir actual
795 '
796
797 test_expect_success 'existing directory and file' '
@@ -800,8 +800,8 @@ test_expect_success 'existing directory and file' '
800 >one &&
801 mkdir top-level-dir &&
802 git check-ignore top-level-dir one >actual &&
803 - grep one actual &&
804 - grep top-level-dir actual
803 + test_grep one actual &&
804 + test_grep top-level-dir actual
805 '
806
807 test_expect_success 'exact prefix matching (with root)' '
t/t0009-git-dir-validation.sh
+3 -3
@@ -35,7 +35,7 @@ test_expect_success PIPE 'setup: .git as a FIFO (named pipe) is rejected' '
35 cd parent/fifo-trap &&
36 mkfifo .git &&
37 test_must_fail git rev-parse --git-dir 2>stderr &&
38 - grep "not a regular file" stderr
38 + test_grep "not a regular file" stderr
39 )
40 '
41
@@ -47,7 +47,7 @@ test_expect_success SYMLINKS,PIPE 'setup: .git as a symlink to a FIFO is rejecte
47 mkfifo target-fifo &&
48 ln -s target-fifo .git &&
49 test_must_fail git rev-parse --git-dir 2>stderr &&
50 - grep "not a regular file" stderr
50 + test_grep "not a regular file" stderr
51 )
52 '
53
@@ -58,7 +58,7 @@ test_expect_success 'setup: .git with garbage content is rejected' '
58 cd parent/garbage-trap &&
59 echo "garbage" >.git &&
60 test_must_fail git rev-parse --git-dir 2>stderr &&
61 - grep "invalid gitfile format" stderr
61 + test_grep "invalid gitfile format" stderr
62 )
63 '
64
t/t0012-help.sh
+2 -2
@@ -131,8 +131,8 @@ test_expect_success 'git help succeeds without git.html' '
131
132 test_expect_success 'git help --user-interfaces' '
133 git help --user-interfaces >help.output &&
134 - grep "^ attributes " help.output &&
135 - grep "^ mailmap " help.output
134 + test_grep "^ attributes " help.output &&
135 + test_grep "^ mailmap " help.output
136 '
137
138 test_expect_success 'git help -c' '
t/t0013-sha1dc.sh
+1 -1
@@ -16,7 +16,7 @@ fi
16 test_expect_success 'test-sha1 detects shattered pdf' '
17 test_must_fail test-tool sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
18 test_grep collision err &&
19 - grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
19 + test_grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
20 '
21
22 test_done
t/t0017-env-helper.sh
+2 -2
@@ -88,7 +88,7 @@ test_expect_success 'test-tool env-helper reads config thanks to trace2' '
88 test_must_fail \
89 env HOME="$(pwd)/home" \
90 git config -l 2>err &&
91 - grep "exceeded maximum include depth" err &&
91 + test_grep "exceeded maximum include depth" err &&
92
93 # This validates that the assumption that we attempt to
94 # read the configuration and fail very early in the start-up
@@ -100,7 +100,7 @@ test_expect_success 'test-tool env-helper reads config thanks to trace2' '
100 test-tool -C no-such-directory \
101 env-helper --type=bool --default=0 \
102 --exit-code GIT_TEST_ENV_HELPER 2>err &&
103 - grep "exceeded maximum include depth" err
103 + test_grep "exceeded maximum include depth" err
104 '
105
106 test_done
t/t0021-conversion.sh
+9 -9
@@ -731,7 +731,7 @@ test_expect_success 'process filter should restart after unexpected write failur
731 rm -f debug.log &&
732 git checkout --quiet --no-progress . 2>git-stderr.log &&
733
734 - grep "smudge write error" git-stderr.log &&
734 + test_grep "smudge write error" git-stderr.log &&
735 test_grep "error: external filter" git-stderr.log &&
736
737 cat >expected.log <<-EOF &&
@@ -853,7 +853,7 @@ test_expect_success 'invalid process filter must fail (and not hang!)' '
853
854 cp "$TEST_ROOT/test.o" test.r &&
855 test_must_fail git add . 2>git-stderr.log &&
856 - grep "expected git-filter-server" git-stderr.log
856 + test_grep "expected git-filter-server" git-stderr.log
857 )
858 '
859
@@ -953,7 +953,7 @@ test_expect_success 'missing file in delayed checkout' '
953
954 rm -rf repo-cloned &&
955 test_must_fail git clone repo repo-cloned 2>git-stderr.log &&
956 - grep "error: .missing-delay\.a. was not filtered properly" git-stderr.log
956 + test_grep "error: .missing-delay\.a. was not filtered properly" git-stderr.log
957 '
958
959 test_expect_success 'invalid file in delayed checkout' '
@@ -974,7 +974,7 @@ test_expect_success 'invalid file in delayed checkout' '
974
975 rm -rf repo-cloned &&
976 test_must_fail git clone repo repo-cloned 2>git-stderr.log &&
977 - grep "error: external filter .* signaled that .unfiltered. is now available although it has not been delayed earlier" git-stderr.log
977 + test_grep "error: external filter .* signaled that .unfiltered. is now available although it has not been delayed earlier" git-stderr.log
978 '
979
980 for mode in 'case' 'utf-8'
@@ -1015,7 +1015,7 @@ do
1015
1016 git clone $mode-collision $mode-collision-cloned &&
1017 # Make sure z was really delayed
1018 - grep "IN: smudge $dir/z .* \\[DELAYED\\]" $mode-collision-cloned/delayed.log &&
1018 + test_grep "IN: smudge $dir/z .* \\[DELAYED\\]" $mode-collision-cloned/delayed.log &&
1019
1020 # Should not create $dir/z at $symlink/z
1021 test_path_is_missing $mode-collision/target-dir/z
@@ -1053,7 +1053,7 @@ test_expect_success SYMLINKS,CASE_INSENSITIVE_FS \
1053 git commit -m super &&
1054
1055 git checkout --recurse-submodules . &&
1056 - grep "IN: smudge A/B/y .* \\[DELAYED\\]" delayed.log &&
1056 + test_grep "IN: smudge A/B/y .* \\[DELAYED\\]" delayed.log &&
1057 test_path_is_missing target-dir/y
1058 )
1059 '
@@ -1144,9 +1144,9 @@ test_expect_success 'delayed checkout correctly reports the number of updated en
1144
1145 rm *.a &&
1146 git checkout . 2>err &&
1147 - grep "IN: smudge test-delay10.a .* \\[DELAYED\\]" delayed.log &&
1148 - grep "IN: smudge test-delay11.a .* \\[DELAYED\\]" delayed.log &&
1149 - grep "Updated 2 paths from the index" err
1147 + test_grep "IN: smudge test-delay10.a .* \\[DELAYED\\]" delayed.log &&
1148 + test_grep "IN: smudge test-delay11.a .* \\[DELAYED\\]" delayed.log &&
1149 + test_grep "Updated 2 paths from the index" err
1150 )
1151 '
1152
t/t0029-core-unsetenvvars.sh
+2 -2
@@ -20,10 +20,10 @@ test_expect_success 'core.unsetenvvars works' '
20 HOBBES=Calvin &&
21 export HOBBES &&
22 git commit --allow-empty -m with 2>err &&
23 - grep Calvin err &&
23 + test_grep Calvin err &&
24 git -c core.unsetenvvars=FINDUS,HOBBES,CALVIN \
25 commit --allow-empty -m without 2>err &&
26 - ! grep Calvin err
26 + test_grep ! Calvin err
27 '
28
29 test_done
t/t0030-stripspace.sh
+2 -2
@@ -407,12 +407,12 @@ test_expect_success 'strip comments with changed comment string' '
407
408 test_expect_success 'newline as commentchar is forbidden' '
409 test_must_fail git -c core.commentChar="$LF" stripspace -s 2>err &&
410 - grep "core.commentchar cannot contain newline" err
410 + test_grep "core.commentchar cannot contain newline" err
411 '
412
413 test_expect_success 'empty commentchar is forbidden' '
414 test_must_fail git -c core.commentchar= stripspace -s 2>err &&
415 - grep "core.commentchar must have at least one character" err
415 + test_grep "core.commentchar must have at least one character" err
416 '
417
418 test_expect_success '-c with single line' '
t/t0031-lockfile-pid.sh
+1 -1
@@ -29,7 +29,7 @@ test_expect_success 'PID info not shown by default' '
29 test_must_fail git add . 2>err &&
30 # Should not crash, just show normal error without PID
31 test_grep "Unable to create" err &&
32 - ! test_grep "is held by process" err
32 + test_grep ! "is held by process" err
33 )
34 '
35
t/t0040-parse-options.sh
+26 -26
@@ -324,13 +324,13 @@ test_expect_success 'non ambiguous option (after two options it abbreviates)' '
324
325 test_expect_success 'Alias options do not contribute to abbreviation' '
326 test-tool parse-options --alias-source 123 >output &&
327 - grep "^string: 123" output &&
327 + test_grep "^string: 123" output &&
328 test-tool parse-options --alias-target 123 >output &&
329 - grep "^string: 123" output &&
329 + test_grep "^string: 123" output &&
330 test_must_fail test-tool parse-options --alias &&
331 GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \
332 test-tool parse-options --alias 123 >output &&
333 - grep "^string: 123" output
333 + test_grep "^string: 123" output
334 '
335
336 cat >typo.err <<\EOF
@@ -582,16 +582,16 @@ test_expect_success 'KEEP_UNKNOWN_OPT works' '
582
583 test_expect_success 'NO_INTERNAL_HELP works for -h' '
584 test_expect_code 129 test-tool parse-options-flags --no-internal-help cmd -h 2>err &&
585 - grep "^error: unknown switch \`h$SQ" err &&
586 - grep "^usage: " err
585 + test_grep "^error: unknown switch \`h$SQ" err &&
586 + test_grep "^usage: " err
587 '
588
589 for help_opt in help help-all
590 do
591 test_expect_success "NO_INTERNAL_HELP works for --$help_opt" "
592 test_expect_code 129 test-tool parse-options-flags --no-internal-help cmd --$help_opt 2>err &&
593 - grep '^error: unknown option \`'$help_opt\' err &&
594 - grep '^usage: ' err
593 + test_grep '^error: unknown option \`'$help_opt\' err &&
594 + test_grep '^usage: ' err
595 "
596 done
597
@@ -608,38 +608,38 @@ test_expect_success 'KEEP_UNKNOWN_OPT | NO_INTERNAL_HELP works' '
608
609 test_expect_success 'subcommand - no subcommand shows error and usage' '
610 test_expect_code 129 test-tool parse-subcommand cmd 2>err &&
611 - grep "^error: need a subcommand" err &&
612 - grep ^usage: err
611 + test_grep "^error: need a subcommand" err &&
612 + test_grep ^usage: err
613 '
614
615 test_expect_success 'subcommand - subcommand after -- shows error and usage' '
616 test_expect_code 129 test-tool parse-subcommand cmd -- subcmd-one 2>err &&
617 - grep "^error: need a subcommand" err &&
618 - grep ^usage: err
617 + test_grep "^error: need a subcommand" err &&
618 + test_grep ^usage: err
619 '
620
621 test_expect_success 'subcommand - subcommand after --end-of-options shows error and usage' '
622 test_expect_code 129 test-tool parse-subcommand cmd --end-of-options subcmd-one 2>err &&
623 - grep "^error: need a subcommand" err &&
624 - grep ^usage: err
623 + test_grep "^error: need a subcommand" err &&
624 + test_grep ^usage: err
625 '
626
627 test_expect_success 'subcommand - unknown subcommand shows error and usage' '
628 test_expect_code 129 test-tool parse-subcommand cmd nope 2>err &&
629 - grep "^error: unknown subcommand: \`nope$SQ" err &&
630 - grep ^usage: err
629 + test_grep "^error: unknown subcommand: \`nope$SQ" err &&
630 + test_grep ^usage: err
631 '
632
633 test_expect_success 'subcommand - subcommands cannot be abbreviated' '
634 test_expect_code 129 test-tool parse-subcommand cmd subcmd-o 2>err &&
635 - grep "^error: unknown subcommand: \`subcmd-o$SQ$" err &&
636 - grep ^usage: err
635 + test_grep "^error: unknown subcommand: \`subcmd-o$SQ$" err &&
636 + test_grep ^usage: err
637 '
638
639 test_expect_success 'subcommand - no negated subcommands' '
640 test_expect_code 129 test-tool parse-subcommand cmd no-subcmd-one 2>err &&
641 - grep "^error: unknown subcommand: \`no-subcmd-one$SQ" err &&
642 - grep ^usage: err
641 + test_grep "^error: unknown subcommand: \`no-subcmd-one$SQ" err &&
642 + test_grep ^usage: err
643 '
644
645 test_expect_success 'subcommand - simple' '
@@ -709,8 +709,8 @@ test_expect_success 'subcommand - SUBCOMMAND_OPTIONAL + subcommand not given + u
709
710 test_expect_success 'subcommand - SUBCOMMAND_OPTIONAL + subcommand not given + unknown option' '
711 test_expect_code 129 test-tool parse-subcommand --subcommand-optional cmd --subcommand-opt 2>err &&
712 - grep "^error: unknown option" err &&
713 - grep ^usage: err
712 + test_grep "^error: unknown option" err &&
713 + test_grep ^usage: err
714 '
715
716 test_expect_success 'subcommand - SUBCOMMAND_OPTIONAL | KEEP_UNKNOWN_OPT + subcommand not given + unknown option' '
@@ -778,28 +778,28 @@ test_expect_success 'subcommand - completion helper' '
778
779 test_expect_success 'subcommands are incompatible with STOP_AT_NON_OPTION' '
780 test_must_fail test-tool parse-subcommand --stop-at-non-option cmd subcmd-one 2>err &&
781 - grep ^BUG err
781 + test_grep ^BUG err
782 '
783
784 test_expect_success 'subcommands are incompatible with KEEP_UNKNOWN_OPT unless in combination with SUBCOMMAND_OPTIONAL' '
785 test_must_fail test-tool parse-subcommand --keep-unknown-opt cmd subcmd-two 2>err &&
786 - grep ^BUG err
786 + test_grep ^BUG err
787 '
788
789 test_expect_success 'subcommands are incompatible with KEEP_DASHDASH unless in combination with SUBCOMMAND_OPTIONAL' '
790 test_must_fail test-tool parse-subcommand --keep-dashdash cmd subcmd-two 2>err &&
791 - grep ^BUG err
791 + test_grep ^BUG err
792 '
793
794 test_expect_success 'negative unsigned' '
795 test_must_fail test-tool parse-options --unsigned -1 >out 2>err &&
796 - grep "non-negative integer" err &&
796 + test_grep "non-negative integer" err &&
797 test_must_be_empty out
798 '
799
800 test_expect_success 'unsigned with units but no numbers' '
801 test_must_fail test-tool parse-options --unsigned m >out 2>err &&
802 - grep "non-negative integer" err &&
802 + test_grep "non-negative integer" err &&
803 test_must_be_empty out
804 '
805
t/t0041-usage.sh
+1 -1
@@ -13,7 +13,7 @@ test_expect_success 'setup ' '
13
14 test_expect_success 'tag --contains <existent_tag>' '
15 git tag --contains "v1.0" >actual 2>actual.err &&
16 - grep "v1.0" actual &&
16 + test_grep "v1.0" actual &&
17 test_line_count = 0 actual.err
18 '
19
t/t0052-simple-ipc.sh
+5 -5
@@ -33,19 +33,19 @@ test_expect_success 'servers cannot share the same path' '
33 test_expect_success 'big response' '
34 test-tool simple-ipc send --token=big >actual &&
35 test_line_count -ge 10000 actual &&
36 - grep -q "big: [0]*9999\$" actual
36 + test_grep -q "big: [0]*9999\$" actual
37 '
38
39 test_expect_success 'chunk response' '
40 test-tool simple-ipc send --token=chunk >actual &&
41 test_line_count -ge 10000 actual &&
42 - grep -q "big: [0]*9999\$" actual
42 + test_grep -q "big: [0]*9999\$" actual
43 '
44
45 test_expect_success 'slow response' '
46 test-tool simple-ipc send --token=slow >actual &&
47 test_line_count -ge 100 actual &&
48 - grep -q "big: [0]*99\$" actual
48 + test_grep -q "big: [0]*99\$" actual
49 '
50
51 # Send an IPC with n=100,000 bytes of ballast. This should be large enough
@@ -54,7 +54,7 @@ test_expect_success 'slow response' '
54 #
55 test_expect_success 'sendbytes' '
56 test-tool simple-ipc sendbytes --bytecount=100000 --byte=A >actual &&
57 - grep "sent:A00100000 rcvd:A00100000" actual
57 + test_grep "sent:A00100000 rcvd:A00100000" actual
58 '
59
60 # Start a series of <threads> client threads that each make <batchsize>
@@ -93,7 +93,7 @@ test_expect_success 'stress test threads' '
93 --batchsize=13 \
94 >actual &&
95 test_line_count = 92 actual &&
96 - grep "good 91" actual &&
96 + test_grep "good 91" actual &&
97 grep "sent:A" <actual >actual_a &&
98 cat >expect_a <<-EOF &&
99 sent:A00000019 rcvd:A00000019
t/t0061-run-command.sh
+1 -1
@@ -97,7 +97,7 @@ test_expect_success POSIXPERM 'run_command reports EACCES' '
97 chmod -x hello.sh &&
98 test_must_fail test-tool run-command run-command ./hello.sh 2>err &&
99
100 - grep "fatal: cannot exec.*hello.sh" err
100 + test_grep "fatal: cannot exec.*hello.sh" err
101 '
102
103 test_expect_success POSIXPERM,SANITY 'unreadable directory in PATH' '
t/t0066-dir-iterator.sh
+1 -1
@@ -127,7 +127,7 @@ test_expect_success SYMLINKS 'dir-iterator should not follow symlinks by default
127 test_expect_success SYMLINKS 'dir-iterator does not resolve top-level symlinks' '
128 test_must_fail test-tool dir-iterator ./dir5 >out &&
129
130 - grep "ENOTDIR" out
130 + test_grep "ENOTDIR" out
131 '
132
133 test_done
t/t0068-for-each-repo.sh
+8 -8
@@ -21,23 +21,23 @@ test_expect_success 'run based on configured value' '
21
22 git for-each-repo --config=run.key commit --allow-empty -m "ran" &&
23 git -C one log -1 --pretty=format:%s >message &&
24 - grep ran message &&
24 + test_grep ran message &&
25 git -C two log -1 --pretty=format:%s >message &&
26 - ! grep ran message &&
26 + test_grep ! ran message &&
27 git -C three log -1 --pretty=format:%s >message &&
28 - grep ran message &&
28 + test_grep ran message &&
29 git -C ~/four log -1 --pretty=format:%s >message &&
30 - grep ran message &&
30 + test_grep ran message &&
31
32 git for-each-repo --config=run.key -- commit --allow-empty -m "ran again" &&
33 git -C one log -1 --pretty=format:%s >message &&
34 - grep again message &&
34 + test_grep again message &&
35 git -C two log -1 --pretty=format:%s >message &&
36 - ! grep again message &&
36 + test_grep ! again message &&
37 git -C three log -1 --pretty=format:%s >message &&
38 - grep again message &&
38 + test_grep again message &&
39 git -C ~/four log -1 --pretty=format:%s >message &&
40 - grep again message &&
40 + test_grep again message &&
41
42 git -C three for-each-repo --config=run.key -- \
43 commit --allow-empty -m "ran from worktree" &&
t/t0070-fundamental.sh
+3 -3
@@ -10,7 +10,7 @@ Verify wrappers and compatibility functions.
10
11 test_expect_success 'mktemp to nonexistent directory prints filename' '
12 test_must_fail test-tool mktemp doesnotexist/testXXXXXX 2>err &&
13 - grep "doesnotexist/test" err
13 + test_grep "doesnotexist/test" err
14 '
15
16 test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints filename' '
@@ -18,7 +18,7 @@ test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints file
18 test_when_finished "chmod +w cannotwrite" &&
19 chmod -w cannotwrite &&
20 test_must_fail test-tool mktemp cannotwrite/testXXXXXX 2>err &&
21 - grep "cannotwrite/test" err
21 + test_grep "cannotwrite/test" err
22 '
23
24 test_expect_success 'git_mkstemps_mode does not fail if fd 0 is not open' '
@@ -33,7 +33,7 @@ test_expect_success 'check for a bug in the regex routines' '
33 test_expect_success 'incomplete sideband messages are reassembled' '
34 test-tool pkt-line send-split-sideband >split-sideband &&
35 test-tool pkt-line receive-sideband <split-sideband 2>err &&
36 - grep "Hello, world" err
36 + test_grep "Hello, world" err
37 '
38
39 test_expect_success 'eof on sideband message is reported' '
t/t0081-find-pack.sh
+6 -6
@@ -52,17 +52,17 @@ test_expect_success 'add more packfiles' '
52
53 # HEAD^{tree} is in 2 packfiles
54 test-tool find-pack HEAD^{tree} >head_tree_packs &&
55 - grep "$head_commit_pack" head_tree_packs &&
56 - grep mypackname1 head_tree_packs &&
57 - ! grep mypackname2 head_tree_packs &&
55 + test_grep "$head_commit_pack" head_tree_packs &&
56 + test_grep mypackname1 head_tree_packs &&
57 + test_grep ! mypackname2 head_tree_packs &&
58 test-tool find-pack --check-count 2 HEAD^{tree} &&
59 ! test-tool find-pack --check-count 1 HEAD^{tree} &&
60
61 # HEAD:five.t is also in 2 packfiles
62 test-tool find-pack HEAD:five.t >five_packs &&
63 - grep "$head_commit_pack" five_packs &&
64 - ! grep mypackname1 five_packs &&
65 - grep mypackname2 five_packs &&
63 + test_grep "$head_commit_pack" five_packs &&
64 + test_grep ! mypackname1 five_packs &&
65 + test_grep mypackname2 five_packs &&
66 test-tool find-pack -c 2 HEAD:five.t &&
67 ! test-tool find-pack --check-count=0 HEAD:five.t
68 '
t/t0091-bugreport.sh
+9 -9
@@ -40,15 +40,15 @@ test_expect_success 'sanity check "System Info" section' '
40
41 # The beginning should match "git version --build-options" verbatim,
42 # but rather than checking bit-for-bit equality, just test some basics.
43 - grep "git version " system &&
44 - grep "shell-path: ." system &&
43 + test_grep "git version " system &&
44 + test_grep "shell-path: ." system &&
45
46 # After the version, there should be some more info.
47 # This is bound to differ from environment to environment,
48 # so we just do some rather high-level checks.
49 - grep "uname: ." system &&
50 - grep "compiler info: ." system &&
51 - grep "zlib." system
49 + test_grep "uname: ." system &&
50 + test_grep "compiler info: ." system &&
51 + test_grep "zlib." system
52 '
53
54 test_expect_success 'dies if file with same name as report already exists' '
@@ -112,7 +112,7 @@ test_expect_success UNZIP '--diagnose creates diagnostics zip archive' '
112 git bugreport --diagnose -o report -s test >out &&
113
114 zip_path=report/git-diagnostics-test.zip &&
115 - grep "Available space" out &&
115 + test_grep "Available space" out &&
116 test_path_is_file "$zip_path" &&
117
118 # Check zipped archive content
@@ -120,10 +120,10 @@ test_expect_success UNZIP '--diagnose creates diagnostics zip archive' '
120 test_file_not_empty out &&
121
122 "$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
123 - grep ".git/objects" out &&
123 + test_grep ".git/objects" out &&
124
125 "$GIT_UNZIP" -p "$zip_path" objects-local.txt >out &&
126 - grep "^Total: [0-9][0-9]*" out &&
126 + test_grep "^Total: [0-9][0-9]*" out &&
127
128 # Should not include .git directory contents by default
129 ! "$GIT_UNZIP" -l "$zip_path" | grep ".git/"
@@ -136,7 +136,7 @@ test_expect_success UNZIP '--diagnose=stats excludes .git dir contents' '
136
137 # Includes pack quantity/size info
138 "$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
139 - grep ".git/objects" out &&
139 + test_grep ".git/objects" out &&
140
141 # Does not include .git directory contents
142 ! "$GIT_UNZIP" -l "$zip_path" | grep ".git/"
t/t0092-diagnose.sh
+6 -6
@@ -8,7 +8,7 @@ test_expect_success UNZIP 'creates diagnostics zip archive' '
8 test_when_finished rm -rf report &&
9
10 git diagnose -o report -s test >out &&
11 - grep "Available space" out &&
11 + test_grep "Available space" out &&
12
13 zip_path=report/git-diagnostics-test.zip &&
14 test_path_is_file "$zip_path" &&
@@ -18,10 +18,10 @@ test_expect_success UNZIP 'creates diagnostics zip archive' '
18 test_file_not_empty out &&
19
20 "$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
21 - grep ".git/objects" out &&
21 + test_grep ".git/objects" out &&
22
23 "$GIT_UNZIP" -p "$zip_path" objects-local.txt >out &&
24 - grep "^Total: [0-9][0-9]*" out &&
24 + test_grep "^Total: [0-9][0-9]*" out &&
25
26 # Should not include .git directory contents by default
27 ! "$GIT_UNZIP" -l "$zip_path" | grep ".git/"
@@ -34,7 +34,7 @@ test_expect_success UNZIP 'counts loose objects' '
34 git diagnose -o test-count -s 1 >out &&
35 zip_path=test-count/git-diagnostics-1.zip &&
36 "$GIT_UNZIP" -p "$zip_path" objects-local.txt >out &&
37 - grep "^Total: [1-9][0-9]* loose objects" out
37 + test_grep "^Total: [1-9][0-9]* loose objects" out
38 '
39
40 test_expect_success UNZIP '--mode=stats excludes .git dir contents' '
@@ -45,7 +45,7 @@ test_expect_success UNZIP '--mode=stats excludes .git dir contents' '
45 # Includes pack quantity/size info
46 zip_path=report/git-diagnostics-test.zip &&
47 "$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
48 - grep ".git/objects" out &&
48 + test_grep ".git/objects" out &&
49
50 # Does not include .git directory contents
51 ! "$GIT_UNZIP" -l "$zip_path" | grep ".git/"
@@ -59,7 +59,7 @@ test_expect_success UNZIP '--mode=all includes .git dir contents' '
59 # Includes pack quantity/size info
60 zip_path=report/git-diagnostics-test.zip &&
61 "$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
62 - grep ".git/objects" out &&
62 + test_grep ".git/objects" out &&
63
64 # Includes .git directory contents
65 "$GIT_UNZIP" -l "$zip_path" | grep ".git/" &&
t/t0100-previous.sh
+1 -1
@@ -50,7 +50,7 @@ test_expect_success 'merge @{-1}~1' '
50 git checkout main &&
51 git merge @{-1}~1 &&
52 git cat-file commit HEAD >actual &&
53 - grep "Merge branch '\''other'\''" actual
53 + test_grep "Merge branch '\''other'\''" actual
54 '
55
56 test_expect_success 'merge @{-100} before checking out that many branches yet' '
t/t0200-gettext-basic.sh
+7 -7
@@ -16,7 +16,7 @@ test_expect_success 'sanity: $TEXTDOMAIN is git' '
16 '
17
18 test_expect_success 'xgettext sanity: Perl _() strings are not extracted' '
19 - ! grep "A Perl string xgettext will not get" "$GIT_PO_PATH"/is.po
19 + test_grep ! "A Perl string xgettext will not get" "$GIT_PO_PATH"/is.po
20 '
21
22 test_expect_success 'xgettext sanity: Comment extraction with --add-comments' '
@@ -26,8 +26,8 @@ test_expect_success 'xgettext sanity: Comment extraction with --add-comments' '
26 '
27
28 test_expect_success 'xgettext sanity: Comment extraction with --add-comments stops at statements' '
29 - ! grep "This is a phony" "$GIT_PO_PATH"/is.po &&
30 - ! grep "the above comment" "$GIT_PO_PATH"/is.po
29 + test_grep ! "This is a phony" "$GIT_PO_PATH"/is.po &&
30 + test_grep ! "the above comment" "$GIT_PO_PATH"/is.po
31 '
32
33 test_expect_success GETTEXT 'sanity: $TEXTDOMAINDIR exists without NO_GETTEXT=YesPlease' '
@@ -44,10 +44,10 @@ test_expect_success GETTEXT 'sanity: Icelandic locale was compiled' '
44 test_expect_success GETTEXT_LOCALE 'sanity: gettext("") metadata is OK' '
45 # Return value may be non-zero
46 LANGUAGE=is LC_ALL="$is_IS_locale" gettext "" >zero-expect &&
47 - grep "Project-Id-Version: Git" zero-expect &&
48 - grep "Git Mailing List <git@vger.kernel.org>" zero-expect &&
49 - grep "Content-Type: text/plain; charset=UTF-8" zero-expect &&
50 - grep "Content-Transfer-Encoding: 8bit" zero-expect
47 + test_grep "Project-Id-Version: Git" zero-expect &&
48 + test_grep "Git Mailing List <git@vger.kernel.org>" zero-expect &&
49 + test_grep "Content-Type: text/plain; charset=UTF-8" zero-expect &&
50 + test_grep "Content-Transfer-Encoding: 8bit" zero-expect
51 '
52
53 test_expect_success GETTEXT_LOCALE 'sanity: gettext(unknown) is passed through' '
t/t0203-gettext-setlocale-sanity.sh
+2 -2
@@ -12,7 +12,7 @@ test_expect_success 'git show a ISO-8859-1 commit under C locale' '
12 test_commit "iso-c-commit" iso-under-c &&
13 git show >out 2>err &&
14 test_must_be_empty err &&
15 - grep -q "iso-c-commit" out
15 + test_grep -q "iso-c-commit" out
16 '
17
18 test_expect_success GETTEXT_LOCALE 'git show a ISO-8859-1 commit under a UTF-8 locale' '
@@ -20,7 +20,7 @@ test_expect_success GETTEXT_LOCALE 'git show a ISO-8859-1 commit under a UTF-8 l
20 test_commit "iso-utf8-commit" iso-under-utf8 &&
21 LANGUAGE=is LC_ALL="$is_IS_locale" git show >out 2>err &&
22 test_must_be_empty err &&
23 - grep -q "iso-utf8-commit" out
23 + test_grep -q "iso-utf8-commit" out
24 '
25
26 test_done
t/t0204-gettext-reencode-sanity.sh
+4 -4
@@ -66,22 +66,22 @@ test_expect_success GETTEXT_LOCALE 'gettext: Fetching a UTF-8 msgid -> UTF-8' '
66 # eyes.
67 test_expect_success GETTEXT_ISO_LOCALE 'gettext: Fetching a UTF-8 msgid -> ISO-8859-1' '
68 LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: ‘single’ and “double” quotes" >actual &&
69 - grep "einfaldar" actual &&
70 - grep "$(echo tvöfaldar | iconv -f UTF-8 -t ISO8859-1)" actual
69 + test_grep "einfaldar" actual &&
70 + test_grep "$(echo tvöfaldar | iconv -f UTF-8 -t ISO8859-1)" actual
71 '
72
73 test_expect_success GETTEXT_LOCALE 'gettext.c: git init UTF-8 -> UTF-8' '
74 printf "Bjó til tóma Git lind" >expect &&
75 LANGUAGE=is LC_ALL="$is_IS_locale" git init repo >actual &&
76 test_when_finished "rm -rf repo" &&
77 - grep "^$(cat expect) " actual
77 + test_grep "^$(cat expect) " actual
78 '
79
80 test_expect_success GETTEXT_ISO_LOCALE 'gettext.c: git init UTF-8 -> ISO-8859-1' '
81 printf "Bjó til tóma Git lind" >expect &&
82 LANGUAGE=is LC_ALL="$is_IS_iso_locale" git init repo >actual &&
83 test_when_finished "rm -rf repo" &&
84 - grep "^$(iconv -f UTF-8 -t ISO8859-1 <expect) " actual
84 + test_grep "^$(iconv -f UTF-8 -t ISO8859-1 <expect) " actual
85 '
86
87 test_done
t/t0210-trace2-normal.sh
+3 -3
@@ -333,12 +333,12 @@ test_expect_success 'unsafe URLs are redacted by default' '
333
334 GIT_TRACE2="$(pwd)/trace.normal" \
335 git clone https://user:pwd@example.com/ clone &&
336 - ! grep user:pwd trace.normal &&
336 + test_grep ! user:pwd trace.normal &&
337
338 GIT_TRACE2_REDACT=0 GIT_TRACE2="$(pwd)/unredacted.normal" \
339 git clone https://user:pwd@example.com/ clone2 &&
340 - grep "start .* clone https://user:pwd@example.com" unredacted.normal &&
341 - grep "remote.origin.url=https://user:pwd@example.com" unredacted.normal
340 + test_grep "start .* clone https://user:pwd@example.com" unredacted.normal &&
341 + test_grep "remote.origin.url=https://user:pwd@example.com" unredacted.normal
342 '
343
344 test_done
t/t0211-trace2-perf.sh
+40 -40
@@ -283,13 +283,13 @@ test_expect_success 'unsafe URLs are redacted by default' '
283
284 GIT_TRACE2_PERF="$(pwd)/trace.perf" \
285 git clone https://user:pwd@example.com/ clone &&
286 - ! grep user:pwd trace.perf &&
286 + test_grep ! user:pwd trace.perf &&
287
288 GIT_TRACE2_REDACT=0 GIT_TRACE2_PERF="$(pwd)/unredacted.perf" \
289 git clone https://user:pwd@example.com/ clone2 &&
290 perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <unredacted.perf >actual &&
291 - grep "d0|main|start|.* clone https://user:pwd@example.com" actual &&
292 - grep "d0|main|def_param|.*|remote.origin.url:https://user:pwd@example.com" actual
291 + test_grep "d0|main|start|.* clone https://user:pwd@example.com" actual &&
292 + test_grep "d0|main|def_param|.*|remote.origin.url:https://user:pwd@example.com" actual
293 '
294
295 # Confirm that the requested command produces a "cmd_name" and a
@@ -358,13 +358,13 @@ test_expect_success LIBCURL \
358
359 perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
360
361 - grep "d0|main|cmd_name|.*|_run_dashed_" actual &&
362 - grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
363 - grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
361 + test_grep "d0|main|cmd_name|.*|_run_dashed_" actual &&
362 + test_grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
363 + test_grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
364
365 - grep "d1|main|cmd_name|.*|remote-curl" actual &&
366 - grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
367 - grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
365 + test_grep "d1|main|cmd_name|.*|remote-curl" actual &&
366 + test_grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
367 + test_grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
368 '
369
370 # Similarly, `git-http-fetch` is not built from git.c so do a
@@ -389,13 +389,13 @@ test_expect_success LIBCURL \
389
390 perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
391
392 - grep "d0|main|cmd_name|.*|_run_dashed_" actual &&
393 - grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
394 - grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
392 + test_grep "d0|main|cmd_name|.*|_run_dashed_" actual &&
393 + test_grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
394 + test_grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
395
396 - grep "d1|main|cmd_name|.*|http-fetch" actual &&
397 - grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
398 - grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
396 + test_grep "d1|main|cmd_name|.*|http-fetch" actual &&
397 + test_grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
398 + test_grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
399 '
400
401 # Historically, alias expansion explicitly emitted the def_param
@@ -421,22 +421,22 @@ test_expect_success 'expect def_params during git alias expansion' '
421 perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
422
423 # "git xxx" is first mapped to "git-xxx" and the child will fail.
424 - grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_)" actual &&
424 + test_grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_)" actual &&
425
426 # We unpeel that and substitute "version" into "xxx" (giving
427 # "git version") and update the cmd_name event.
428 - grep "d0|main|cmd_name|.*|_run_git_alias_ (_run_dashed_/_run_git_alias_)" actual &&
428 + test_grep "d0|main|cmd_name|.*|_run_git_alias_ (_run_dashed_/_run_git_alias_)" actual &&
429
430 # These def_param events could be associated with either of the
431 # above cmd_name events. It does not matter.
432 - grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
433 - grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
432 + test_grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
433 + test_grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
434
435 # The "git version" child sees a different cmd_name hierarchy.
436 # Also test the def_param (only for completeness).
437 - grep "d1|main|cmd_name|.*|version (_run_dashed_/_run_git_alias_/version)" actual &&
438 - grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
439 - grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
437 + test_grep "d1|main|cmd_name|.*|version (_run_dashed_/_run_git_alias_/version)" actual &&
438 + test_grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
439 + test_grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
440 '
441
442 test_expect_success 'expect def_params during shell alias expansion' '
@@ -456,25 +456,25 @@ test_expect_success 'expect def_params during shell alias expansion' '
456 perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
457
458 # "git xxx" is first mapped to "git-xxx" and the child will fail.
459 - grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_)" actual &&
459 + test_grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_)" actual &&
460
461 # We unpeel that and substitute "git version" for "git xxx" (as a
462 # shell command. Another cmd_name event is emitted as we unpeel.
463 - grep "d0|main|cmd_name|.*|_run_shell_alias_ (_run_dashed_/_run_shell_alias_)" actual &&
463 + test_grep "d0|main|cmd_name|.*|_run_shell_alias_ (_run_dashed_/_run_shell_alias_)" actual &&
464
465 # These def_param events could be associated with either of the
466 # above cmd_name events. It does not matter.
467 - grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
468 - grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
467 + test_grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
468 + test_grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
469
470 # We get the following only because we used a git command for the
471 # shell command. In general, it could have been a shell script and
472 # we would see nothing.
473 #
474 # The child knows the cmd_name hierarchy so it includes it.
475 - grep "d1|main|cmd_name|.*|version (_run_dashed_/_run_shell_alias_/version)" actual &&
476 - grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
477 - grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
475 + test_grep "d1|main|cmd_name|.*|version (_run_dashed_/_run_shell_alias_/version)" actual &&
476 + test_grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
477 + test_grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
478 '
479
480 test_expect_success 'expect def_params during nested git alias expansion' '
@@ -496,33 +496,33 @@ test_expect_success 'expect def_params during nested git alias expansion' '
496
497 # "git xxx" is first mapped to "git-xxx" and try to spawn "git-xxx"
498 # and the child will fail.
499 - grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_)" actual &&
500 - grep "d0|main|child_start|.*|.* class:dashed argv:\[git-xxx\]" actual &&
499 + test_grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_)" actual &&
500 + test_grep "d0|main|child_start|.*|.* class:dashed argv:\[git-xxx\]" actual &&
501
502 # We unpeel that and substitute "yyy" into "xxx" (giving "git yyy")
503 # and spawn "git-yyy" and the child will fail.
504 - grep "d0|main|alias|.*|alias:xxx argv:\[yyy\]" actual &&
505 - grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_/_run_dashed_)" actual &&
506 - grep "d0|main|child_start|.*|.* class:dashed argv:\[git-yyy\]" actual &&
504 + test_grep "d0|main|alias|.*|alias:xxx argv:\[yyy\]" actual &&
505 + test_grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_/_run_dashed_)" actual &&
506 + test_grep "d0|main|child_start|.*|.* class:dashed argv:\[git-yyy\]" actual &&
507
508 # We unpeel that and substitute "version" into "xxx" (giving
509 # "git version") and update the cmd_name event.
510 - grep "d0|main|alias|.*|alias:yyy argv:\[version\]" actual &&
511 - grep "d0|main|cmd_name|.*|_run_git_alias_ (_run_dashed_/_run_dashed_/_run_git_alias_)" actual &&
510 + test_grep "d0|main|alias|.*|alias:yyy argv:\[version\]" actual &&
511 + test_grep "d0|main|cmd_name|.*|_run_git_alias_ (_run_dashed_/_run_dashed_/_run_git_alias_)" actual &&
512
513 # These def_param events could be associated with any of the
514 # above cmd_name events. It does not matter.
515 grep "d0|main|def_param|.*|cfg.prop.foo:red" actual >actual.matches &&
516 - grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
516 + test_grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
517
518 # However, we do not want them repeated each time we unpeel.
519 test_line_count = 1 actual.matches &&
520
521 # The "git version" child sees a different cmd_name hierarchy.
522 # Also test the def_param (only for completeness).
523 - grep "d1|main|cmd_name|.*|version (_run_dashed_/_run_dashed_/_run_git_alias_/version)" actual &&
524 - grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
525 - grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
523 + test_grep "d1|main|cmd_name|.*|version (_run_dashed_/_run_dashed_/_run_git_alias_/version)" actual &&
524 + test_grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
525 + test_grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
526 '
527
528 test_done
t/t0212-trace2-event.sh
+4 -4
@@ -332,7 +332,7 @@ test_expect_success 'unsafe URLs are redacted by default in cmd_start events' '
332
333 GIT_TRACE2_EVENT="$(pwd)/trace.event" \
334 test-tool trace2 300redact_start git clone https://user:pwd@example.com/ clone2 &&
335 - ! grep user:pwd trace.event
335 + test_grep ! user:pwd trace.event
336 '
337
338 test_expect_success 'unsafe URLs are redacted by default in child_start events' '
@@ -341,7 +341,7 @@ test_expect_success 'unsafe URLs are redacted by default in child_start events'
341
342 GIT_TRACE2_EVENT="$(pwd)/trace.event" \
343 test-tool trace2 301redact_child_start git clone https://user:pwd@example.com/ clone2 &&
344 - ! grep user:pwd trace.event
344 + test_grep ! user:pwd trace.event
345 '
346
347 test_expect_success 'unsafe URLs are redacted by default in exec events' '
@@ -350,7 +350,7 @@ test_expect_success 'unsafe URLs are redacted by default in exec events' '
350
351 GIT_TRACE2_EVENT="$(pwd)/trace.event" \
352 test-tool trace2 302redact_exec git clone https://user:pwd@example.com/ clone2 &&
353 - ! grep user:pwd trace.event
353 + test_grep ! user:pwd trace.event
354 '
355
356 test_expect_success 'unsafe URLs are redacted by default in def_param events' '
@@ -359,7 +359,7 @@ test_expect_success 'unsafe URLs are redacted by default in def_param events' '
359
360 GIT_TRACE2_EVENT="$(pwd)/trace.event" \
361 test-tool trace2 303redact_def_param url https://user:pwd@example.com/ &&
362 - ! grep user:pwd trace.event
362 + test_grep ! user:pwd trace.event
363 '
364
365 test_done
t/t0300-credentials.sh
+2 -2
@@ -1014,7 +1014,7 @@ test_expect_success 'credential config with partial URLs' '
1014 do
1015 git -c credential.$partial.helper=yep \
1016 credential fill <stdin >stdout &&
1017 - grep yep stdout ||
1017 + test_grep yep stdout ||
1018 return 1
1019 done &&
1020
@@ -1030,7 +1030,7 @@ test_expect_success 'credential config with partial URLs' '
1030 do
1031 git -c credential.$partial.helper=yep \
1032 credential fill <stdin >stdout &&
1033 - ! grep yep stdout ||
1033 + test_grep ! yep stdout ||
1034 return 1
1035 done &&
1036
t/t0410-partial-clone.sh
+41 -41
@@ -206,7 +206,7 @@ test_expect_success 'fetching of missing objects' '
206 git -C repo cat-file -p "$HASH" 2>err &&
207
208 # Ensure that no spurious FETCH_HEAD messages are written
209 - ! grep FETCH_HEAD err &&
209 + test_grep ! FETCH_HEAD err &&
210
211 # Ensure that the .promisor file is written, and check that its
212 # associated packfile contains the object
@@ -214,7 +214,7 @@ test_expect_success 'fetching of missing objects' '
214 test_line_count = 1 promisorlist &&
215 IDX=$(sed "s/promisor$/idx/" promisorlist) &&
216 git verify-pack --verbose "$IDX" >out &&
217 - grep "$HASH" out
217 + test_grep "$HASH" out
218 '
219
220 test_expect_success 'fetching of a promised object that promisor remote no longer has' '
@@ -228,7 +228,7 @@ test_expect_success 'fetching of a promised object that promisor remote no longe
228
229 rm -rf unreliable-server/.git/objects/* &&
230 test_must_fail git -C unreliable-client checkout HEAD 2>err &&
231 - grep "could not fetch.*from promisor remote" err
231 + test_grep "could not fetch.*from promisor remote" err
232 '
233
234 test_expect_success 'fetching of missing objects works with ref-in-want enabled' '
@@ -240,7 +240,7 @@ test_expect_success 'fetching of missing objects works with ref-in-want enabled'
240 rm -rf repo/.git/objects/* &&
241 rm -f trace &&
242 GIT_TRACE_PACKET="$(pwd)/trace" git -C repo cat-file -p "$HASH" &&
243 - grep "fetch< fetch=.*ref-in-want" trace
243 + test_grep "fetch< fetch=.*ref-in-want" trace
244 '
245
246 test_expect_success 'fetching from another promisor remote' '
@@ -263,7 +263,7 @@ test_expect_success 'fetching from another promisor remote' '
263 test_line_count = 1 promisorlist &&
264 IDX=$(sed "s/promisor$/idx/" promisorlist) &&
265 git verify-pack --verbose "$IDX" >out &&
266 - grep "$HASH2" out
266 + test_grep "$HASH2" out
267 '
268
269 test_expect_success 'fetching with --filter configures a promisor remote' '
@@ -286,7 +286,7 @@ test_expect_success 'fetching with --filter configures a promisor remote' '
286 test_line_count = 1 promisorlist &&
287 IDX=$(sed "s/promisor$/idx/" promisorlist) &&
288 git verify-pack --verbose "$IDX" >out &&
289 - grep "$HASH3" out
289 + test_grep "$HASH3" out
290 '
291
292 test_expect_success 'fetching of missing blobs works' '
@@ -327,8 +327,8 @@ test_expect_success 'fetching of missing trees does not fetch blobs' '
327
328 # Ensure that the tree, but not the blob, is fetched
329 git -C repo rev-list --objects --missing=print $(cat treehash) >objects &&
330 - grep "^$(cat treehash)" objects &&
331 - grep "^[?]$(cat blobhash)" objects
330 + test_grep "^$(cat treehash)" objects &&
331 + test_grep "^[?]$(cat blobhash)" objects
332 '
333
334 test_expect_success 'rev-list stops traversal at missing and promised commit' '
@@ -343,8 +343,8 @@ test_expect_success 'rev-list stops traversal at missing and promised commit' '
343 git -C repo config core.repositoryformatversion 1 &&
344 git -C repo config extensions.partialclone "arbitrary string" &&
345 git -C repo rev-list --exclude-promisor-objects --objects bar >out &&
346 - grep $(git -C repo rev-parse bar) out &&
347 - ! grep $FOO out
346 + test_grep $(git -C repo rev-parse bar) out &&
347 + test_grep ! $FOO out
348 '
349
350 test_expect_success 'missing tree objects with --missing=allow-promisor and --exclude-promisor-objects' '
@@ -413,10 +413,10 @@ test_expect_success 'rev-list stops traversal at missing and promised tree' '
413 git -C repo config core.repositoryformatversion 1 &&
414 git -C repo config extensions.partialclone "arbitrary string" &&
415 git -C repo rev-list --exclude-promisor-objects --objects HEAD >out &&
416 - grep $(git -C repo rev-parse foo) out &&
417 - ! grep $TREE out &&
418 - grep $(git -C repo rev-parse HEAD) out &&
419 - ! grep $TREE2 out
416 + test_grep $(git -C repo rev-parse foo) out &&
417 + test_grep ! $TREE out &&
418 + test_grep $(git -C repo rev-parse HEAD) out &&
419 + test_grep ! $TREE2 out
420 '
421
422 test_expect_success 'rev-list stops traversal at missing and promised blob' '
@@ -432,8 +432,8 @@ test_expect_success 'rev-list stops traversal at missing and promised blob' '
432 git -C repo config core.repositoryformatversion 1 &&
433 git -C repo config extensions.partialclone "arbitrary string" &&
434 git -C repo rev-list --exclude-promisor-objects --objects HEAD >out &&
435 - grep $(git -C repo rev-parse HEAD) out &&
436 - ! grep $BLOB out
435 + test_grep $(git -C repo rev-parse HEAD) out &&
436 + test_grep ! $BLOB out
437 '
438
439 test_expect_success 'rev-list stops traversal at promisor commit, tree, and blob' '
@@ -451,10 +451,10 @@ test_expect_success 'rev-list stops traversal at promisor commit, tree, and blob
451 git -C repo config core.repositoryformatversion 1 &&
452 git -C repo config extensions.partialclone "arbitrary string" &&
453 git -C repo rev-list --exclude-promisor-objects --objects HEAD >out &&
454 - ! grep $COMMIT out &&
455 - ! grep $TREE out &&
456 - ! grep $BLOB out &&
457 - grep $(git -C repo rev-parse bar) out # sanity check that some walking was done
454 + test_grep ! $COMMIT out &&
455 + test_grep ! $TREE out &&
456 + test_grep ! $BLOB out &&
457 + test_grep $(git -C repo rev-parse bar) out # sanity check that some walking was done
458 '
459
460 test_expect_success 'rev-list dies for missing objects on cmd line' '
@@ -523,10 +523,10 @@ test_expect_success 'gc repacks promisor objects separately from non-promisor ob
523 test_line_count = 1 promisorlist &&
524 PROMISOR_PACKFILE=$(sed "s/.promisor/.pack/" <promisorlist) &&
525 git verify-pack $PROMISOR_PACKFILE -v >out &&
526 - grep "$TREE_ONE" out &&
527 - grep "$TREE_TWO" out &&
528 - ! grep "$(git -C repo rev-parse one)" out &&
529 - ! grep "$(git -C repo rev-parse two)" out &&
526 + test_grep "$TREE_ONE" out &&
527 + test_grep "$TREE_TWO" out &&
528 + test_grep ! "$(git -C repo rev-parse one)" out &&
529 + test_grep ! "$(git -C repo rev-parse two)" out &&
530
531 # Remove the promisor packfile and associated files
532 rm $(sed "s/.promisor//" <promisorlist).* &&
@@ -536,10 +536,10 @@ test_expect_success 'gc repacks promisor objects separately from non-promisor ob
536 ls repo/.git/objects/pack/pack-*.pack >packlist &&
537 test_line_count = 1 packlist &&
538 git verify-pack repo/.git/objects/pack/pack-*.pack -v >out &&
539 - grep "$(git -C repo rev-parse one)" out &&
540 - grep "$(git -C repo rev-parse two)" out &&
541 - ! grep "$TREE_ONE" out &&
542 - ! grep "$TREE_TWO" out
539 + test_grep "$(git -C repo rev-parse one)" out &&
540 + test_grep "$(git -C repo rev-parse two)" out &&
541 + test_grep ! "$TREE_ONE" out &&
542 + test_grep ! "$TREE_TWO" out
543 '
544
545 test_expect_success 'gc does not repack promisor objects if there are none' '
@@ -616,8 +616,8 @@ test_expect_success 'gc stops traversal when a missing but promised object is re
616 ls repo/.git/objects/pack/pack-*.pack >packlist &&
617 test_line_count = 1 packlist &&
618 git verify-pack repo/.git/objects/pack/pack-*.pack -v >out &&
619 - grep "$(git -C repo rev-parse HEAD)" out &&
620 - ! grep "$TREE_HASH" out
619 + test_grep "$(git -C repo rev-parse HEAD)" out &&
620 + test_grep ! "$TREE_HASH" out
621 '
622
623 test_expect_success 'do not fetch when checking existence of tree we construct ourselves' '
@@ -647,10 +647,10 @@ test_expect_success 'exact rename does not need to fetch the blob lazily' '
647
648 git clone --filter=blob:none --bare "file://$(pwd)/repo" partial.git &&
649 git -C partial.git rev-list --objects --missing=print HEAD >out &&
650 - grep "[?]$FILE_HASH" out &&
650 + test_grep "[?]$FILE_HASH" out &&
651 git -C partial.git log --follow -- new-file.txt &&
652 git -C partial.git rev-list --objects --missing=print HEAD >out &&
653 - grep "[?]$FILE_HASH" out
653 + test_grep "[?]$FILE_HASH" out
654 '
655
656 test_expect_success 'lazy-fetch when accessing object not in the_repository' '
@@ -665,7 +665,7 @@ test_expect_success 'lazy-fetch when accessing object not in the_repository' '
665
666 # Sanity check that the file is missing
667 git -C partial.git rev-list --objects --missing=print HEAD >out &&
668 - grep "[?]$FILE_HASH" out &&
668 + test_grep "[?]$FILE_HASH" out &&
669
670 # The no-lazy-fetch mechanism prevents Git from fetching
671 test_must_fail env GIT_NO_LAZY_FETCH=1 \
@@ -680,7 +680,7 @@ test_expect_success 'lazy-fetch when accessing object not in the_repository' '
680
681 # Sanity check that the file is still missing
682 git -C partial.git rev-list --objects --missing=print HEAD >out &&
683 - grep "[?]$FILE_HASH" out &&
683 + test_grep "[?]$FILE_HASH" out &&
684
685 git -C full cat-file -s "$FILE_HASH" >expect &&
686 test-tool partial-clone object-info partial.git "$FILE_HASH" >actual &&
@@ -688,7 +688,7 @@ test_expect_success 'lazy-fetch when accessing object not in the_repository' '
688
689 # Sanity check that the file is now present
690 git -C partial.git rev-list --objects --missing=print HEAD >out &&
691 - ! grep "[?]$FILE_HASH" out
691 + test_grep ! "[?]$FILE_HASH" out
692 '
693
694 test_expect_success 'push should not fetch new commit objects' '
@@ -705,9 +705,9 @@ test_expect_success 'push should not fetch new commit objects' '
705 COMMIT=$(git -C server rev-parse server2) &&
706
707 test_must_fail git -C client push 2>err &&
708 - grep "fetch first" err &&
708 + test_grep "fetch first" err &&
709 git -C client rev-list --objects --missing=print "$COMMIT" >objects &&
710 - grep "^[?]$COMMIT" objects
710 + test_grep "^[?]$COMMIT" objects
711 '
712
713 test_expect_success 'setup for promisor.quiet tests' '
@@ -750,7 +750,7 @@ test_expect_success TTY 'promisor.quiet=false shows progress messages' '
750 test_terminal git -C repo cat-file -p foo:foo.t 2>err &&
751
752 # Ensure that progress messages are written
753 - grep "Receiving objects" err
753 + test_grep "Receiving objects" err
754 '
755
756 test_expect_success TTY 'promisor.quiet=true does not show progress messages' '
@@ -761,7 +761,7 @@ test_expect_success TTY 'promisor.quiet=true does not show progress messages' '
761 test_terminal git -C repo cat-file -p foo:foo.t 2>err &&
762
763 # Ensure that no progress messages are written
764 - ! grep "Receiving objects" err
764 + test_grep ! "Receiving objects" err
765 '
766
767 test_expect_success TTY 'promisor.quiet=unconfigured shows progress messages' '
@@ -771,7 +771,7 @@ test_expect_success TTY 'promisor.quiet=unconfigured shows progress messages' '
771 test_terminal git -C repo cat-file -p foo:foo.t 2>err &&
772
773 # Ensure that progress messages are written
774 - grep "Receiving objects" err
774 + test_grep "Receiving objects" err
775 '
776
777 test_expect_success 'promisor.quiet from submodule repo is honored' '
@@ -819,7 +819,7 @@ test_expect_success 'fetching of missing objects from an HTTP server' '
819 test_line_count = 1 promisorlist &&
820 IDX=$(sed "s/promisor$/idx/" promisorlist) &&
821 git verify-pack --verbose "$IDX" >out &&
822 - grep "$HASH" out
822 + test_grep "$HASH" out
823 '
824
825 # DO NOT add non-httpd-specific tests here, because the last part of this
t/t0450-txt-doc-vs-help.sh
+1 -1
@@ -87,7 +87,7 @@ do
87 # -h output assertions
88 test_expect_success "$builtin -h output has no \t" '
89 h2s="$(help_to_synopsis "$builtin")" &&
90 - ! grep "$HT" "$h2s"
90 + test_grep ! "$HT" "$h2s"
91 '
92
93 test_expect_success "$builtin -h output has dashed labels" '
t/t0500-progress-display.sh
+9 -9
@@ -320,8 +320,8 @@ test_expect_success 'progress generates traces' '
320
321 # t0212/parse_events.perl intentionally omits regions and data.
322 test_region progress "Working hard" trace.event &&
323 - grep "\"key\":\"total_objects\",\"value\":\"40\"" trace.event &&
324 - grep "\"key\":\"total_bytes\",\"value\":\"409600\"" trace.event
323 + test_grep "\"key\":\"total_objects\",\"value\":\"40\"" trace.event &&
324 + test_grep "\"key\":\"total_bytes\",\"value\":\"409600\"" trace.event
325 '
326
327 test_expect_success 'progress generates traces: stop / start' '
@@ -344,8 +344,8 @@ test_expect_success 'progress generates traces: start without stop' '
344 LSAN_OPTIONS=detect_leaks=0 \
345 test-tool progress \
346 <in 2>stderr &&
347 - grep region_enter.*progress trace-start.event &&
348 - ! grep region_leave.*progress trace-start.event
347 + test_grep region_enter.*progress trace-start.event &&
348 + test_grep ! region_leave.*progress trace-start.event
349 '
350
351 test_expect_success 'progress generates traces: stop without start' '
@@ -355,8 +355,8 @@ test_expect_success 'progress generates traces: stop without start' '
355
356 GIT_TRACE2_EVENT="$PWD/trace-stop.event" test-tool progress \
357 <in 2>stderr &&
358 - ! grep region_enter.*progress trace-stop.event &&
359 - ! grep region_leave.*progress trace-stop.event
358 + test_grep ! region_enter.*progress trace-stop.event &&
359 + test_grep ! region_leave.*progress trace-stop.event
360 '
361
362 test_expect_success 'progress generates traces: start with active progress bar (no stops)' '
@@ -369,9 +369,9 @@ test_expect_success 'progress generates traces: start with active progress bar (
369 LSAN_OPTIONS=detect_leaks=0 \
370 test-tool progress \
371 <in 2>stderr &&
372 - grep region_enter.*progress.*One trace-2start.event &&
373 - grep region_enter.*progress.*Two trace-2start.event &&
374 - ! grep region_leave trace-2start.event
372 + test_grep region_enter.*progress.*One trace-2start.event &&
373 + test_grep region_enter.*progress.*Two trace-2start.event &&
374 + test_grep ! region_leave trace-2start.event
375 '
376
377 test_done
t/t0610-reftable-basics.sh
+4 -4
@@ -776,11 +776,11 @@ test_expect_success 'reflog: can delete separate reflog entries' '
776 test_commit file3 &&
777 test_commit file4 &&
778 git reflog >actual &&
779 - grep file3 actual &&
779 + test_grep file3 actual &&
780
781 git reflog delete HEAD@{1} &&
782 git reflog >actual &&
783 - ! grep file3 actual
783 + test_grep ! file3 actual
784 )
785 '
786
@@ -902,8 +902,8 @@ test_expect_success 'reflog: garbage collection deletes reflog entries' '
902 done &&
903 git reflog refs/heads/main >actual &&
904 test_line_count = 10 actual &&
905 - grep "commit (initial): number 1" actual &&
906 - grep "commit: number 10" actual &&
905 + test_grep "commit (initial): number 1" actual &&
906 + test_grep "commit: number 10" actual &&
907
908 git gc &&
909 git reflog refs/heads/main >actual &&
t/t1004-read-tree-m-u-wf.sh
+4 -4
@@ -142,8 +142,8 @@ test_expect_success '3-way not overwriting local changes (our side)' '
142
143 echo >>file1 "local changes" &&
144 read_tree_u_must_succeed -m -u branch-point side-a side-b &&
145 - grep "new line to be kept" file1 &&
146 - grep "local changes" file1
145 + test_grep "new line to be kept" file1 &&
146 + test_grep "local changes" file1
147
148 '
149
@@ -156,8 +156,8 @@ test_expect_success '3-way not overwriting local changes (their side)' '
156
157 echo >>file2 "local changes" &&
158 read_tree_u_must_fail -m -u branch-point side-a side-b &&
159 - ! grep "new line to be kept" file2 &&
160 - grep "local changes" file2
159 + test_grep ! "new line to be kept" file2 &&
160 + test_grep "local changes" file2
161
162 '
163
t/t1006-cat-file.sh
+9 -9
@@ -696,8 +696,8 @@ test_expect_success '%(deltabase) reports packed delta bases' '
696 git repack -ad &&
697 git cat-file --batch-check="%(deltabase)" <blobs >actual &&
698 {
699 - grep "$(git rev-parse HEAD:foo)" actual ||
700 - grep "$(git rev-parse HEAD:foo-plus)" actual
699 + test_grep "$(git rev-parse HEAD:foo)" actual ||
700 + test_grep "$(git rev-parse HEAD:foo-plus)" actual
701 }
702 '
703
@@ -826,7 +826,7 @@ test_expect_success 'cat-file -t and -s on corrupt loose object' '
826 # Swap the two to corrupt the repository
827 mv -f "$other_path" "$empty_path" &&
828 test_must_fail git fsck 2>err.fsck &&
829 - grep "hash-path mismatch" err.fsck &&
829 + test_grep "hash-path mismatch" err.fsck &&
830
831 # confirm that cat-file is reading the new swapped-in
832 # blob...
@@ -1318,37 +1318,37 @@ test_expect_success 'cat-file --batch-all-objects --batch-check ignores replace'
1318 test_expect_success 'batch-command empty command' '
1319 echo "" >cmd &&
1320 test_expect_code 128 git cat-file --batch-command <cmd 2>err &&
1321 - grep "^fatal:.*empty command in input.*" err
1321 + test_grep "^fatal:.*empty command in input.*" err
1322 '
1323
1324 test_expect_success 'batch-command whitespace before command' '
1325 echo " info deadbeef" >cmd &&
1326 test_expect_code 128 git cat-file --batch-command <cmd 2>err &&
1327 - grep "^fatal:.*whitespace before command.*" err
1327 + test_grep "^fatal:.*whitespace before command.*" err
1328 '
1329
1330 test_expect_success 'batch-command unknown command' '
1331 echo unknown_command >cmd &&
1332 test_expect_code 128 git cat-file --batch-command <cmd 2>err &&
1333 - grep "^fatal:.*unknown command.*" err
1333 + test_grep "^fatal:.*unknown command.*" err
1334 '
1335
1336 test_expect_success 'batch-command missing arguments' '
1337 echo "info" >cmd &&
1338 test_expect_code 128 git cat-file --batch-command <cmd 2>err &&
1339 - grep "^fatal:.*info requires arguments.*" err
1339 + test_grep "^fatal:.*info requires arguments.*" err
1340 '
1341
1342 test_expect_success 'batch-command flush with arguments' '
1343 echo "flush arg" >cmd &&
1344 test_expect_code 128 git cat-file --batch-command --buffer <cmd 2>err &&
1345 - grep "^fatal:.*flush takes no arguments.*" err
1345 + test_grep "^fatal:.*flush takes no arguments.*" err
1346 '
1347
1348 test_expect_success 'batch-command flush without --buffer' '
1349 echo "flush" >cmd &&
1350 test_expect_code 128 git cat-file --batch-command <cmd 2>err &&
1351 - grep "^fatal:.*flush is only for --buffer mode.*" err
1351 + test_grep "^fatal:.*flush is only for --buffer mode.*" err
1352 '
1353
1354 perl_script='
t/t1007-hash-object.sh
+4 -4
@@ -202,7 +202,7 @@ done
202 test_expect_success 'too-short tree' '
203 echo abc >malformed-tree &&
204 test_must_fail git hash-object -t tree malformed-tree 2>err &&
205 - grep "too-short tree object" err
205 + test_grep "too-short tree object" err
206 '
207
208 test_expect_success PERL_TEST_HELPERS 'malformed mode in tree' '
@@ -210,7 +210,7 @@ test_expect_success PERL_TEST_HELPERS 'malformed mode in tree' '
210 bin_oid=$(echo $hex_oid | hex2oct) &&
211 printf "9100644 \0$bin_oid" >tree-with-malformed-mode &&
212 test_must_fail git hash-object -t tree tree-with-malformed-mode 2>err &&
213 - grep "malformed mode in tree entry" err
213 + test_grep "malformed mode in tree entry" err
214 '
215
216 test_expect_success PERL_TEST_HELPERS 'empty filename in tree' '
@@ -218,7 +218,7 @@ test_expect_success PERL_TEST_HELPERS 'empty filename in tree' '
218 bin_oid=$(echo $hex_oid | hex2oct) &&
219 printf "100644 \0$bin_oid" >tree-with-empty-filename &&
220 test_must_fail git hash-object -t tree tree-with-empty-filename 2>err &&
221 - grep "empty filename in tree entry" err
221 + test_grep "empty filename in tree entry" err
222 '
223
224 test_expect_success PERL_TEST_HELPERS 'duplicate filename in tree' '
@@ -229,7 +229,7 @@ test_expect_success PERL_TEST_HELPERS 'duplicate filename in tree' '
229 printf "100644 file\0$bin_oid"
230 } >tree-with-duplicate-filename &&
231 test_must_fail git hash-object -t tree tree-with-duplicate-filename 2>err &&
232 - grep "duplicateEntries" err
232 + test_grep "duplicateEntries" err
233 '
234
235 test_expect_success 'corrupt commit' '
t/t1011-read-tree-sparse-checkout.sh
+5 -5
@@ -196,7 +196,7 @@ test_expect_success 'read-tree will not throw away dirty changes, non-sparse' '
196 echo dirty >init.t &&
197 read_tree_u_must_fail -m -u HEAD^ &&
198 test_path_is_file init.t &&
199 - grep -q dirty init.t
199 + test_grep -q dirty init.t
200 '
201
202 test_expect_success 'read-tree will not throw away dirty changes, sparse' '
@@ -207,7 +207,7 @@ test_expect_success 'read-tree will not throw away dirty changes, sparse' '
207 echo sub/added >.git/info/sparse-checkout &&
208 read_tree_u_must_fail -m -u HEAD^ &&
209 test_path_is_file init.t &&
210 - grep -q dirty init.t
210 + test_grep -q dirty init.t
211 '
212
213 test_expect_success 'read-tree updates worktree, dirty case' '
@@ -215,7 +215,7 @@ test_expect_success 'read-tree updates worktree, dirty case' '
215 git checkout -f top &&
216 echo dirty >init.t &&
217 read_tree_u_must_fail -m -u HEAD^ &&
218 - grep -q dirty init.t &&
218 + test_grep -q dirty init.t &&
219 rm init.t
220 '
221
@@ -224,7 +224,7 @@ test_expect_success 'read-tree removes worktree, dirty case' '
224 git checkout -f top &&
225 echo dirty >added &&
226 read_tree_u_must_succeed -m -u HEAD^ &&
227 - grep -q dirty added
227 + test_grep -q dirty added
228 '
229
230 test_expect_success 'read-tree adds to worktree, absent case' '
@@ -240,7 +240,7 @@ test_expect_success 'read-tree adds to worktree, dirty case' '
240 mkdir sub &&
241 echo dirty >sub/added &&
242 read_tree_u_must_succeed -u -m HEAD^ &&
243 - grep -q dirty sub/added
243 + test_grep -q dirty sub/added
244 '
245
246 test_expect_success 'index removal and worktree narrowing at the same time' '
t/t1050-large.sh
+3 -3
@@ -8,7 +8,7 @@ test_description='adding and checking out large blobs'
8 test_expect_success 'core.bigFileThreshold must be non-negative' '
9 : >input &&
10 test_must_fail git -c core.bigFileThreshold=-1 hash-object input >out 2>err &&
11 - grep "bad numeric config value" err &&
11 + test_grep "bad numeric config value" err &&
12 test_must_be_empty out
13 '
14
@@ -148,12 +148,12 @@ test_expect_success 'diff --stat' '
148
149 test_expect_success 'diff' '
150 git diff HEAD^ HEAD >actual &&
151 - grep "Binary files.*differ" actual
151 + test_grep "Binary files.*differ" actual
152 '
153
154 test_expect_success 'diff --cached' '
155 git diff --cached HEAD^ >actual &&
156 - grep "Binary files.*differ" actual
156 + test_grep "Binary files.*differ" actual
157 '
158
159 test_expect_success 'hash-object' '
t/t1091-sparse-checkout-builtin.sh
+12 -12
@@ -129,7 +129,7 @@ test_expect_success 'switching to cone mode with non-cone mode patterns' '
129 git sparse-checkout add dir &&
130 git config --worktree core.sparseCheckoutCone true &&
131 test_must_fail git sparse-checkout add dir 2>err &&
132 - grep "existing sparse-checkout patterns do not use cone mode" err
132 + test_grep "existing sparse-checkout patterns do not use cone mode" err
133 )
134 '
135
@@ -803,7 +803,7 @@ test_expect_success 'cone mode clears ignored subdirectories' '
803 # When an untracked file is in the way, all untracked files
804 # (even ignored files) are preserved.
805 git -C repo sparse-checkout set folder1 2>err &&
806 - grep "contains untracked files" err &&
806 + test_grep "contains untracked files" err &&
807 test_path_is_file repo/deep/deeper2/ignored.o &&
808 test_path_is_file repo/deep/deeper2/untracked &&
809
@@ -882,8 +882,8 @@ test_expect_success 'malformed cone-mode patterns' '
882 # of using the cone-mode translation to a set of directories.
883 git -C repo sparse-checkout list >actual 2>err &&
884 test_cmp repo/.git/info/sparse-checkout actual &&
885 - grep "warning: your sparse-checkout file may have issues: pattern .* is repeated" err &&
886 - grep "warning: disabling cone pattern matching" err
885 + test_grep "warning: your sparse-checkout file may have issues: pattern .* is repeated" err &&
886 + test_grep "warning: disabling cone pattern matching" err
887 '
888
889 test_expect_success 'set from subdir pays attention to prefix' '
@@ -917,34 +917,34 @@ test_expect_success 'set from subdir in non-cone mode throws an error' '
917 git -C repo sparse-checkout disable &&
918 test_must_fail git -C repo/deep sparse-checkout set --no-cone deeper2 ../folder1 2>error &&
919
920 - grep "run from the toplevel directory in non-cone mode" error
920 + test_grep "run from the toplevel directory in non-cone mode" error
921 '
922
923 test_expect_success 'set from subdir in non-cone mode throws an error' '
924 git -C repo sparse-checkout set --no-cone deep/deeper2 &&
925 test_must_fail git -C repo/deep sparse-checkout add deeper1/deepest ../folder1 2>error &&
926
927 - grep "run from the toplevel directory in non-cone mode" error
927 + test_grep "run from the toplevel directory in non-cone mode" error
928 '
929
930 test_expect_success 'by default, cone mode will error out when passed files' '
931 git -C repo sparse-checkout reapply --cone &&
932 test_must_fail git -C repo sparse-checkout add .gitignore 2>error &&
933
934 - grep ".gitignore.*is not a directory" error
934 + test_grep ".gitignore.*is not a directory" error
935 '
936
937 test_expect_success 'error on mistyped command line options' '
938 test_must_fail git -C repo sparse-checkout add --sikp-checks .gitignore 2>error &&
939
940 - grep "unknown option.*sikp-checks" error
940 + test_grep "unknown option.*sikp-checks" error
941 '
942
943 test_expect_success 'by default, non-cone mode will warn on individual files' '
944 git -C repo sparse-checkout reapply --no-cone &&
945 git -C repo sparse-checkout add .gitignore 2>warning &&
946
947 - grep "pass a leading slash before paths.*if you want a single file" warning
947 + test_grep "pass a leading slash before paths.*if you want a single file" warning
948 '
949
950 test_expect_success 'setup bare repo' '
@@ -1108,11 +1108,11 @@ test_expect_success 'clean' '
1108 touch repo/folder1/extra/inside/file &&
1109
1110 test_must_fail git -C repo sparse-checkout clean 2>err &&
1111 - grep "refusing to clean" err &&
1111 + test_grep "refusing to clean" err &&
1112
1113 git -C repo config clean.requireForce true &&
1114 test_must_fail git -C repo sparse-checkout clean 2>err &&
1115 - grep "refusing to clean" err &&
1115 + test_grep "refusing to clean" err &&
1116
1117 cat >expect <<-\EOF &&
1118 Would remove deep/deeper2/
@@ -1255,7 +1255,7 @@ test_expect_success 'sparse-checkout operations with merge conflicts' '
1255 test_must_fail git merge -m "will-conflict" right &&
1256
1257 test_must_fail git sparse-checkout clean -f 2>err &&
1258 - grep "failed to convert index to a sparse index" err &&
1258 + test_grep "failed to convert index to a sparse index" err &&
1259
1260 echo merged >folder1/even/more/dirs/file &&
1261 git add --sparse folder1 &&
t/t1092-sparse-checkout-compatibility.sh
+22 -22
@@ -454,10 +454,10 @@ test_expect_success 'add outside sparse cone' '
454 run_on_sparse ../edit-contents folder1/a &&
455 run_on_sparse ../edit-contents folder1/newfile &&
456 test_sparse_match test_must_fail git add folder1/a &&
457 - grep "Disable or modify the sparsity rules" sparse-checkout-err &&
457 + test_grep "Disable or modify the sparsity rules" sparse-checkout-err &&
458 test_sparse_unstaged folder1/a &&
459 test_sparse_match test_must_fail git add folder1/newfile &&
460 - grep "Disable or modify the sparsity rules" sparse-checkout-err &&
460 + test_grep "Disable or modify the sparsity rules" sparse-checkout-err &&
461 test_sparse_unstaged folder1/newfile
462 '
463
@@ -509,13 +509,13 @@ test_expect_success 'status/add: outside sparse cone' '
509
510 # Adding the path outside of the sparse-checkout cone should fail.
511 test_sparse_match test_must_fail git add folder1/a &&
512 - grep "Disable or modify the sparsity rules" sparse-checkout-err &&
512 + test_grep "Disable or modify the sparsity rules" sparse-checkout-err &&
513 test_sparse_unstaged folder1/a &&
514 test_all_match git add --refresh folder1/a &&
515 test_must_be_empty sparse-checkout-err &&
516 test_sparse_unstaged folder1/a &&
517 test_sparse_match test_must_fail git add folder1/new &&
518 - grep "Disable or modify the sparsity rules" sparse-checkout-err &&
518 + test_grep "Disable or modify the sparsity rules" sparse-checkout-err &&
519 test_sparse_unstaged folder1/new &&
520 test_sparse_match git add --sparse folder1/a &&
521 test_sparse_match git add --sparse folder1/new &&
@@ -661,8 +661,8 @@ test_expect_success 'checkout and reset (mixed)' '
661 # in sparse-checkout or sparse-index.
662 git -C full-checkout reset update-folder1 >full-checkout-out &&
663 test_sparse_match git reset update-folder1 &&
664 - grep "M folder1/a" full-checkout-out &&
665 - ! grep "M folder1/a" sparse-checkout-out &&
664 + test_grep "M folder1/a" full-checkout-out &&
665 + test_grep ! "M folder1/a" sparse-checkout-out &&
666 run_on_sparse test_path_is_missing folder1
667 '
668
@@ -880,8 +880,8 @@ test_expect_success 'update-index with directories' '
880 # update-index will exit silently when provided with a directory name
881 # containing a trailing slash
882 test_all_match git update-index deep/ folder1/ &&
883 - grep "Ignoring path deep/" sparse-checkout-err &&
884 - grep "Ignoring path folder1/" sparse-checkout-err &&
883 + test_grep "Ignoring path deep/" sparse-checkout-err &&
884 + test_grep "Ignoring path folder1/" sparse-checkout-err &&
885
886 # When update-index is given a directory name WITHOUT a trailing slash, it will
887 # behave in different ways depending on the status of the directory on disk:
@@ -1067,7 +1067,7 @@ test_expect_success 'merge with conflict outside cone' '
1067
1068 # 2. Add the file with conflict markers
1069 test_sparse_match test_must_fail git add folder1/a &&
1070 - grep "Disable or modify the sparsity rules" sparse-checkout-err &&
1070 + test_grep "Disable or modify the sparsity rules" sparse-checkout-err &&
1071 test_sparse_unstaged folder1/a &&
1072 test_all_match git add --sparse folder1/a &&
1073 test_all_match git status --porcelain=v2 &&
@@ -1076,7 +1076,7 @@ test_expect_success 'merge with conflict outside cone' '
1076 # accept conflict markers as resolved content.
1077 run_on_all mv folder2/a folder2/z &&
1078 test_sparse_match test_must_fail git add folder2 &&
1079 - grep "Disable or modify the sparsity rules" sparse-checkout-err &&
1079 + test_grep "Disable or modify the sparsity rules" sparse-checkout-err &&
1080 test_sparse_unstaged folder2/z &&
1081 test_all_match git add --sparse folder2 &&
1082 test_all_match git status --porcelain=v2 &&
@@ -1107,7 +1107,7 @@ test_expect_success 'cherry-pick/rebase with conflict outside cone' '
1107 # SKIP_WORKTREE bit from the index entry for folder1/a, we should
1108 # warn that this is a problematic add.
1109 test_sparse_match test_must_fail git add folder1/a &&
1110 - grep "Disable or modify the sparsity rules" sparse-checkout-err &&
1110 + test_grep "Disable or modify the sparsity rules" sparse-checkout-err &&
1111 test_sparse_unstaged folder1/a &&
1112 test_all_match git add --sparse folder1/a &&
1113 test_all_match git status --porcelain=v2 &&
@@ -1119,7 +1119,7 @@ test_expect_success 'cherry-pick/rebase with conflict outside cone' '
1119 # existing index entry with the SKIP_WORKTREE bit cleared.
1120 run_on_all mv folder2/a folder2/z &&
1121 test_sparse_match test_must_fail git add folder2 &&
1122 - grep "Disable or modify the sparsity rules" sparse-checkout-err &&
1122 + test_grep "Disable or modify the sparsity rules" sparse-checkout-err &&
1123 test_sparse_unstaged folder2/z &&
1124 test_all_match git add --sparse folder2 &&
1125 test_all_match git status --porcelain=v2 &&
@@ -1266,7 +1266,7 @@ test_expect_success 'checkout-index with folders' '
1266 run_on_all test_must_fail git checkout-index -f -- folder1/ &&
1267 test_cmp full-checkout-err sparse-checkout-err &&
1268 ! test_cmp full-checkout-err sparse-index-err &&
1269 - grep "is a sparse directory" sparse-index-err
1269 + test_grep "is a sparse directory" sparse-index-err
1270 '
1271
1272 test_expect_success 'checkout-index --all' '
@@ -1374,8 +1374,8 @@ test_expect_success 'submodule handling' '
1374 # having a submodule prevents "modules" from collapse
1375 test_sparse_match git sparse-checkout set deep/deeper1 &&
1376 git -C sparse-index ls-files --sparse --stage >cache &&
1377 - grep "100644 .* modules/a" cache &&
1378 - grep "160000 $(git -C initial-repo rev-parse HEAD) 0 modules/sub" cache
1377 + test_grep "100644 .* modules/a" cache &&
1378 + test_grep "160000 $(git -C initial-repo rev-parse HEAD) 0 modules/sub" cache
1379 '
1380
1381 test_expect_success 'git apply functionality' '
@@ -1392,7 +1392,7 @@ test_expect_success 'git apply functionality' '
1392
1393 # Apply a patch to a file outside the sparse definition
1394 test_sparse_match test_must_fail git apply ../patch-outside &&
1395 - grep "No such file or directory" sparse-checkout-err &&
1395 + test_grep "No such file or directory" sparse-checkout-err &&
1396
1397 # But it works with --index and --cached
1398 test_all_match git apply --index --stat ../patch-outside &&
@@ -2013,9 +2013,9 @@ test_expect_success 'mv directory from out-of-cone to in-cone' '
2013 test_all_match git status --porcelain=v2 &&
2014 test_sparse_match git ls-files -t &&
2015 git -C sparse-checkout ls-files -t >actual &&
2016 - grep -e "H deep/folder1/0/0/0" actual &&
2017 - grep -e "H deep/folder1/0/1" actual &&
2018 - grep -e "H deep/folder1/a" actual &&
2016 + test_grep -e "H deep/folder1/0/0/0" actual &&
2017 + test_grep -e "H deep/folder1/0/1" actual &&
2018 + test_grep -e "H deep/folder1/a" actual &&
2019
2020 test_all_match git reset --hard &&
2021
@@ -2025,8 +2025,8 @@ test_expect_success 'mv directory from out-of-cone to in-cone' '
2025 test_sparse_match git status --porcelain=v2 &&
2026 test_sparse_match git ls-files -t &&
2027 git -C sparse-checkout ls-files -t >actual &&
2028 - grep -e "H deep/0/0/0" actual &&
2029 - grep -e "H deep/0/1" actual
2028 + test_grep -e "H deep/0/0/0" actual &&
2029 + test_grep -e "H deep/0/1" actual
2030 '
2031
2032 test_expect_success 'rm pathspec inside sparse definition' '
@@ -2517,7 +2517,7 @@ test_expect_success 'advice.sparseIndexExpanded' '
2517 mkdir -p sparse-index/deep/deeper2/deepest &&
2518 touch sparse-index/deep/deeper2/deepest/bogus &&
2519 git -C sparse-index status 2>err &&
2520 - grep "The sparse index is expanding to a full index" err &&
2520 + test_grep "The sparse index is expanding to a full index" err &&
2521
2522 git -C sparse-index sparse-checkout disable 2>err &&
2523 test_line_count = 0 err
t/t1300-config.sh
+8 -8
@@ -800,7 +800,7 @@ test_expect_success 'renaming a section with an overly-long line' '
800 printf "[a] g = h\\n"
801 } >y &&
802 test_must_fail git config ${mode_prefix}rename-section -f y a xyz 2>err &&
803 - grep "refusing to work with overly long line in .y. on line 2" err
803 + test_grep "refusing to work with overly long line in .y. on line 2" err
804 '
805
806 cat >> .git/config << EOF
@@ -1615,9 +1615,9 @@ test_expect_success 'git --config-env=key=envvar support' '
1615
1616 test_expect_success 'git --config-env with missing value' '
1617 test_must_fail env ENVVAR=value git --config-env 2>error &&
1618 - grep "no config key given for --config-env" error &&
1618 + test_grep "no config key given for --config-env" error &&
1619 test_must_fail env ENVVAR=value git --config-env config core.name 2>error &&
1620 - grep "invalid config format: config" error
1620 + test_grep "invalid config format: config" error
1621 '
1622
1623 test_expect_success 'git --config-env fails with invalid parameters' '
@@ -2048,7 +2048,7 @@ test_expect_success '--unset last key removes section (except if commented)' '
2048 key = true
2049 EOF
2050 git config ${mode_unset} two.key &&
2051 - ! grep two .git/config &&
2051 + test_grep ! two .git/config &&
2052
2053 q_to_tab >.git/config <<-\EOF &&
2054 [one]
@@ -2068,7 +2068,7 @@ test_expect_success '--unset last key removes section (except if commented)' '
2068 Qkey = true
2069 EOF
2070 git config ${mode_unset} two.key &&
2071 - grep two .git/config &&
2071 + test_grep two .git/config &&
2072
2073 q_to_tab >.git/config <<-\EOF &&
2074 [one]
@@ -2599,7 +2599,7 @@ test_expect_success '--type rejects unknown specifiers' '
2599
2600 test_expect_success '--type=int requires at least one digit' '
2601 test_must_fail git config --type int --default m some.key >out 2>error &&
2602 - grep "bad numeric config value" error &&
2602 + test_grep "bad numeric config value" error &&
2603 test_must_be_empty out
2604 '
2605
@@ -2911,12 +2911,12 @@ test_expect_success 'includeIf.hasconfig:remote.*.url forbids remote url in such
2911
2912 # test with any Git command
2913 test_must_fail git -C hasremoteurlTest status 2>err &&
2914 - grep "fatal: remote URLs cannot be configured in file directly or indirectly included by includeIf.hasconfig:remote.*.url" err
2914 + test_grep "fatal: remote URLs cannot be configured in file directly or indirectly included by includeIf.hasconfig:remote.*.url" err
2915 '
2916
2917 test_expect_success 'negated mode causes failure' '
2918 test_must_fail git config --no-get 2>err &&
2919 - grep "unknown option \`no-get${SQ}" err
2919 + test_grep "unknown option \`no-get${SQ}" err
2920 '
2921
2922 test_expect_success 'specifying multiple modes causes failure' '
t/t1305-config-include.sh
+1 -1
@@ -353,7 +353,7 @@ test_expect_success 'include cycles are detected' '
353 git -C cycle --git-dir=. config include.path cycle &&
354 git config -f cycle/cycle include.path config &&
355 test_must_fail git -C cycle --git-dir=. config --get-all test.value 2>stderr &&
356 - grep "exceeded maximum include depth" stderr
356 + test_grep "exceeded maximum include depth" stderr
357 '
358
359 test_expect_success 'onbranch with unborn branch' '
t/t1308-config-set.sh
+3 -3
@@ -180,7 +180,7 @@ test_expect_success 'find integer if value is non parse-able' '
180
181 test_expect_success 'non parse-able integer value during iteration' '
182 check_config expect_code 128 git_config_int lamb.head 2>result &&
183 - grep "fatal: bad numeric config value .* in file \.git/config" result
183 + test_grep "fatal: bad numeric config value .* in file \.git/config" result
184 '
185
186 test_expect_success 'find bool value for the entered key' '
@@ -302,7 +302,7 @@ test_expect_success 'proper error on directory "files"' '
302 echo "Error (-1) reading configuration file a-directory." >expect &&
303 mkdir a-directory &&
304 test_expect_code 2 test-tool config configset_get_value foo.bar a-directory 2>output &&
305 - grep "^warning:" output &&
305 + test_grep "^warning:" output &&
306 grep "^Error" output >actual &&
307 test_cmp expect actual
308 '
@@ -312,7 +312,7 @@ test_expect_success POSIXPERM,SANITY 'proper error on non-accessible files' '
312 test_when_finished "chmod +r .git/config" &&
313 echo "Error (-1) reading configuration file .git/config." >expect &&
314 test_expect_code 2 test-tool config configset_get_value foo.bar .git/config 2>output &&
315 - grep "^warning:" output &&
315 + test_grep "^warning:" output &&
316 grep "^Error" output >actual &&
317 test_cmp expect actual
318 '
t/t1400-update-ref.sh
+88 -85
@@ -92,7 +92,7 @@ test_expect_success "deleting current branch adds message to HEAD's log" '
92 git update-ref -m delete-$m -d $m &&
93 test_must_fail git show-ref --verify -q $m &&
94 test-tool ref-store main for-each-reflog-ent HEAD >actual &&
95 - grep "delete-$m$" actual
95 + test_grep "delete-$m$" actual
96 '
97
98 test_expect_success "deleting by HEAD adds message to HEAD's log" '
@@ -102,7 +102,7 @@ test_expect_success "deleting by HEAD adds message to HEAD's log" '
102 git update-ref -m delete-by-head -d HEAD &&
103 test_must_fail git show-ref --verify -q $m &&
104 test-tool ref-store main for-each-reflog-ent HEAD >actual &&
105 - grep "delete-by-head$" actual
105 + test_grep "delete-by-head$" actual
106 '
107
108 test_expect_success 'update-ref does not create reflogs by default' '
@@ -192,7 +192,10 @@ test_expect_success "move $m (by HEAD)" '
192 test_expect_success "delete $m (by HEAD) should remove both packed and loose $m" '
193 test_when_finished "git update-ref -d $m" &&
194 git update-ref -d HEAD $B &&
195 - ! grep "$m" .git/packed-refs &&
195 + if test_have_prereq REFFILES
196 + then
197 + test_grep ! "$m" .git/packed-refs
198 + fi &&
199 test_must_fail git show-ref --verify -q $m
200 '
201
@@ -575,103 +578,103 @@ test_expect_success 'stdin works with no input' '
578 test_expect_success 'stdin fails on empty line' '
579 echo "" >stdin &&
580 test_must_fail git update-ref --stdin <stdin 2>err &&
578 - grep "fatal: empty command in input" err
581 + test_grep "fatal: empty command in input" err
582 '
583
584 test_expect_success 'stdin fails on only whitespace' '
585 echo " " >stdin &&
586 test_must_fail git update-ref --stdin <stdin 2>err &&
584 - grep "fatal: whitespace before command: " err
587 + test_grep "fatal: whitespace before command: " err
588 '
589
590 test_expect_success 'stdin fails on leading whitespace' '
591 echo " create $a $m" >stdin &&
592 test_must_fail git update-ref --stdin <stdin 2>err &&
590 - grep "fatal: whitespace before command: create $a $m" err
593 + test_grep "fatal: whitespace before command: create $a $m" err
594 '
595
596 test_expect_success 'stdin fails on unknown command' '
597 echo "unknown $a" >stdin &&
598 test_must_fail git update-ref --stdin <stdin 2>err &&
596 - grep "fatal: unknown command: unknown $a" err
599 + test_grep "fatal: unknown command: unknown $a" err
600 '
601
602 test_expect_success 'stdin fails on unbalanced quotes' '
603 echo "create $a \"main" >stdin &&
604 test_must_fail git update-ref --stdin <stdin 2>err &&
602 - grep "fatal: badly quoted argument: \\\"main" err
605 + test_grep "fatal: badly quoted argument: \\\"main" err
606 '
607
608 test_expect_success 'stdin fails on invalid escape' '
609 echo "create $a \"ma\zn\"" >stdin &&
610 test_must_fail git update-ref --stdin <stdin 2>err &&
608 - grep "fatal: badly quoted argument: \\\"ma\\\\zn\\\"" err
611 + test_grep "fatal: badly quoted argument: \\\"ma\\\\zn\\\"" err
612 '
613
614 test_expect_success 'stdin fails on junk after quoted argument' '
615 echo "create \"$a\"main" >stdin &&
616 test_must_fail git update-ref --stdin <stdin 2>err &&
614 - grep "fatal: unexpected character after quoted argument: \\\"$a\\\"main" err
617 + test_grep "fatal: unexpected character after quoted argument: \\\"$a\\\"main" err
618 '
619
620 test_expect_success 'stdin fails create with no ref' '
621 echo "create " >stdin &&
622 test_must_fail git update-ref --stdin <stdin 2>err &&
620 - grep "fatal: create: missing <ref>" err
623 + test_grep "fatal: create: missing <ref>" err
624 '
625
626 test_expect_success 'stdin fails create with no new value' '
627 echo "create $a" >stdin &&
628 test_must_fail git update-ref --stdin <stdin 2>err &&
626 - grep "fatal: create $a: missing <new-oid>" err
629 + test_grep "fatal: create $a: missing <new-oid>" err
630 '
631
632 test_expect_success 'stdin fails create with too many arguments' '
633 echo "create $a $m $m" >stdin &&
634 test_must_fail git update-ref --stdin <stdin 2>err &&
632 - grep "fatal: create $a: extra input: $m" err
635 + test_grep "fatal: create $a: extra input: $m" err
636 '
637
638 test_expect_success 'stdin fails update with no ref' '
639 echo "update " >stdin &&
640 test_must_fail git update-ref --stdin <stdin 2>err &&
638 - grep "fatal: update: missing <ref>" err
641 + test_grep "fatal: update: missing <ref>" err
642 '
643
644 test_expect_success 'stdin fails update with no new value' '
645 echo "update $a" >stdin &&
646 test_must_fail git update-ref --stdin <stdin 2>err &&
644 - grep "fatal: update $a: missing <new-oid>" err
647 + test_grep "fatal: update $a: missing <new-oid>" err
648 '
649
650 test_expect_success 'stdin fails update with too many arguments' '
651 echo "update $a $m $m $m" >stdin &&
652 test_must_fail git update-ref --stdin <stdin 2>err &&
650 - grep "fatal: update $a: extra input: $m" err
653 + test_grep "fatal: update $a: extra input: $m" err
654 '
655
656 test_expect_success 'stdin fails delete with no ref' '
657 echo "delete " >stdin &&
658 test_must_fail git update-ref --stdin <stdin 2>err &&
656 - grep "fatal: delete: missing <ref>" err
659 + test_grep "fatal: delete: missing <ref>" err
660 '
661
662 test_expect_success 'stdin fails delete with too many arguments' '
663 echo "delete $a $m $m" >stdin &&
664 test_must_fail git update-ref --stdin <stdin 2>err &&
662 - grep "fatal: delete $a: extra input: $m" err
665 + test_grep "fatal: delete $a: extra input: $m" err
666 '
667
668 test_expect_success 'stdin fails verify with too many arguments' '
669 echo "verify $a $m $m" >stdin &&
670 test_must_fail git update-ref --stdin <stdin 2>err &&
668 - grep "fatal: verify $a: extra input: $m" err
671 + test_grep "fatal: verify $a: extra input: $m" err
672 '
673
674 test_expect_success 'stdin fails option with unknown name' '
675 echo "option unknown" >stdin &&
676 test_must_fail git update-ref --stdin <stdin 2>err &&
674 - grep "fatal: option unknown: unknown" err
677 + test_grep "fatal: option unknown: unknown" err
678 '
679
680 test_expect_success 'stdin fails with duplicate refs' '
@@ -759,28 +762,28 @@ test_expect_success 'stdin create ref works with path with space to blob' '
762 test_expect_success 'stdin update ref fails with wrong old value' '
763 echo "update $c $m $m~1" >stdin &&
764 test_must_fail git update-ref --stdin <stdin 2>err &&
762 - grep "fatal: cannot lock ref '"'"'$c'"'"'" err &&
765 + test_grep "fatal: cannot lock ref '"'"'$c'"'"'" err &&
766 test_must_fail git rev-parse --verify -q $c
767 '
768
769 test_expect_success 'stdin update ref fails with bad old value' '
770 echo "update $c $m does-not-exist" >stdin &&
771 test_must_fail git update-ref --stdin <stdin 2>err &&
769 - grep "fatal: update $c: invalid <old-oid>: does-not-exist" err &&
772 + test_grep "fatal: update $c: invalid <old-oid>: does-not-exist" err &&
773 test_must_fail git rev-parse --verify -q $c
774 '
775
776 test_expect_success 'stdin create ref fails with bad new value' '
777 echo "create $c does-not-exist" >stdin &&
778 test_must_fail git update-ref --stdin <stdin 2>err &&
776 - grep "fatal: create $c: invalid <new-oid>: does-not-exist" err &&
779 + test_grep "fatal: create $c: invalid <new-oid>: does-not-exist" err &&
780 test_must_fail git rev-parse --verify -q $c
781 '
782
783 test_expect_success 'stdin create ref fails with zero new value' '
784 echo "create $c " >stdin &&
785 test_must_fail git update-ref --stdin <stdin 2>err &&
783 - grep "fatal: create $c: zero <new-oid>" err &&
786 + test_grep "fatal: create $c: zero <new-oid>" err &&
787 test_must_fail git rev-parse --verify -q $c
788 '
789
@@ -795,7 +798,7 @@ test_expect_success 'stdin update ref works with right old value' '
798 test_expect_success 'stdin delete ref fails with wrong old value' '
799 echo "delete $a $m~1" >stdin &&
800 test_must_fail git update-ref --stdin <stdin 2>err &&
798 - grep "fatal: cannot lock ref '"'"'$a'"'"'" err &&
801 + test_grep "fatal: cannot lock ref '"'"'$a'"'"'" err &&
802 git rev-parse $m >expect &&
803 git rev-parse $a >actual &&
804 test_cmp expect actual
@@ -804,7 +807,7 @@ test_expect_success 'stdin delete ref fails with wrong old value' '
807 test_expect_success 'stdin delete ref fails with zero old value' '
808 echo "delete $a " >stdin &&
809 test_must_fail git update-ref --stdin <stdin 2>err &&
807 - grep "fatal: delete $a: zero <old-oid>" err &&
810 + test_grep "fatal: delete $a: zero <old-oid>" err &&
811 git rev-parse $m >expect &&
812 git rev-parse $a >actual &&
813 test_cmp expect actual
@@ -965,7 +968,7 @@ test_expect_success 'stdin update refs fails with wrong old value' '
968 update $c ''
969 EOF
970 test_must_fail git update-ref --stdin <stdin 2>err &&
968 - grep "fatal: cannot lock ref '"'"'$c'"'"'" err &&
971 + test_grep "fatal: cannot lock ref '"'"'$c'"'"'" err &&
972 git rev-parse $m >expect &&
973 git rev-parse $a >actual &&
974 test_cmp expect actual &&
@@ -998,123 +1001,123 @@ test_expect_success 'stdin -z works on empty input' '
1001 test_expect_success 'stdin -z fails on empty line' '
1002 echo "" >stdin &&
1003 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1001 - grep "fatal: whitespace before command: " err
1004 + test_grep "fatal: whitespace before command: " err
1005 '
1006
1007 test_expect_success 'stdin -z fails on empty command' '
1008 printf $F "" >stdin &&
1009 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1007 - grep "fatal: empty command in input" err
1010 + test_grep "fatal: empty command in input" err
1011 '
1012
1013 test_expect_success 'stdin -z fails on only whitespace' '
1014 printf $F " " >stdin &&
1015 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1013 - grep "fatal: whitespace before command: " err
1016 + test_grep "fatal: whitespace before command: " err
1017 '
1018
1019 test_expect_success 'stdin -z fails on leading whitespace' '
1020 printf $F " create $a" "$m" >stdin &&
1021 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1019 - grep "fatal: whitespace before command: create $a" err
1022 + test_grep "fatal: whitespace before command: create $a" err
1023 '
1024
1025 test_expect_success 'stdin -z fails on unknown command' '
1026 printf $F "unknown $a" >stdin &&
1027 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1025 - grep "fatal: unknown command: unknown $a" err
1028 + test_grep "fatal: unknown command: unknown $a" err
1029 '
1030
1031 test_expect_success 'stdin -z fails create with no ref' '
1032 printf $F "create " >stdin &&
1033 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1031 - grep "fatal: create: missing <ref>" err
1034 + test_grep "fatal: create: missing <ref>" err
1035 '
1036
1037 test_expect_success 'stdin -z fails create with no new value' '
1038 printf $F "create $a" >stdin &&
1039 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1037 - grep "fatal: create $a: unexpected end of input when reading <new-oid>" err
1040 + test_grep "fatal: create $a: unexpected end of input when reading <new-oid>" err
1041 '
1042
1043 test_expect_success 'stdin -z fails create with too many arguments' '
1044 printf $F "create $a" "$m" "$m" >stdin &&
1045 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1043 - grep "fatal: unknown command: $m" err
1046 + test_grep "fatal: unknown command: $m" err
1047 '
1048
1049 test_expect_success 'stdin -z fails update with no ref' '
1050 printf $F "update " >stdin &&
1051 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1049 - grep "fatal: update: missing <ref>" err
1052 + test_grep "fatal: update: missing <ref>" err
1053 '
1054
1055 test_expect_success 'stdin -z fails update with too few args' '
1056 printf $F "update $a" "$m" >stdin &&
1057 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1055 - grep "fatal: update $a: unexpected end of input when reading <old-oid>" err
1058 + test_grep "fatal: update $a: unexpected end of input when reading <old-oid>" err
1059 '
1060
1061 test_expect_success 'stdin -z emits warning with empty new value' '
1062 git update-ref $a $m &&
1063 printf $F "update $a" "" "" >stdin &&
1064 git update-ref -z --stdin <stdin 2>err &&
1062 - grep "warning: update $a: missing <new-oid>, treating as zero" err &&
1065 + test_grep "warning: update $a: missing <new-oid>, treating as zero" err &&
1066 test_must_fail git rev-parse --verify -q $a
1067 '
1068
1069 test_expect_success 'stdin -z fails update with no new value' '
1070 printf $F "update $a" >stdin &&
1071 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1069 - grep "fatal: update $a: unexpected end of input when reading <new-oid>" err
1072 + test_grep "fatal: update $a: unexpected end of input when reading <new-oid>" err
1073 '
1074
1075 test_expect_success 'stdin -z fails update with no old value' '
1076 printf $F "update $a" "$m" >stdin &&
1077 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1075 - grep "fatal: update $a: unexpected end of input when reading <old-oid>" err
1078 + test_grep "fatal: update $a: unexpected end of input when reading <old-oid>" err
1079 '
1080
1081 test_expect_success 'stdin -z fails update with too many arguments' '
1082 printf $F "update $a" "$m" "$m" "$m" >stdin &&
1083 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1081 - grep "fatal: unknown command: $m" err
1084 + test_grep "fatal: unknown command: $m" err
1085 '
1086
1087 test_expect_success 'stdin -z fails delete with no ref' '
1088 printf $F "delete " >stdin &&
1089 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1087 - grep "fatal: delete: missing <ref>" err
1090 + test_grep "fatal: delete: missing <ref>" err
1091 '
1092
1093 test_expect_success 'stdin -z fails delete with no old value' '
1094 printf $F "delete $a" >stdin &&
1095 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1093 - grep "fatal: delete $a: unexpected end of input when reading <old-oid>" err
1096 + test_grep "fatal: delete $a: unexpected end of input when reading <old-oid>" err
1097 '
1098
1099 test_expect_success 'stdin -z fails delete with too many arguments' '
1100 printf $F "delete $a" "$m" "$m" >stdin &&
1101 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1099 - grep "fatal: unknown command: $m" err
1102 + test_grep "fatal: unknown command: $m" err
1103 '
1104
1105 test_expect_success 'stdin -z fails verify with too many arguments' '
1106 printf $F "verify $a" "$m" "$m" >stdin &&
1107 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1105 - grep "fatal: unknown command: $m" err
1108 + test_grep "fatal: unknown command: $m" err
1109 '
1110
1111 test_expect_success 'stdin -z fails verify with no old value' '
1112 printf $F "verify $a" >stdin &&
1113 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1111 - grep "fatal: verify $a: unexpected end of input when reading <old-oid>" err
1114 + test_grep "fatal: verify $a: unexpected end of input when reading <old-oid>" err
1115 '
1116
1117 test_expect_success 'stdin -z fails option with unknown name' '
1118 printf $F "option unknown" >stdin &&
1119 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1117 - grep "fatal: option unknown: unknown" err
1120 + test_grep "fatal: option unknown: unknown" err
1121 '
1122
1123 test_expect_success 'stdin -z fails with duplicate refs' '
@@ -1160,14 +1163,14 @@ test_expect_success 'stdin -z create ref works with path with space to blob' '
1163 test_expect_success 'stdin -z update ref fails with wrong old value' '
1164 printf $F "update $c" "$m" "$m~1" >stdin &&
1165 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1163 - grep "fatal: cannot lock ref '"'"'$c'"'"'" err &&
1166 + test_grep "fatal: cannot lock ref '"'"'$c'"'"'" err &&
1167 test_must_fail git rev-parse --verify -q $c
1168 '
1169
1170 test_expect_success 'stdin -z update ref fails with bad old value' '
1171 printf $F "update $c" "$m" "does-not-exist" >stdin &&
1172 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1170 - grep "fatal: update $c: invalid <old-oid>: does-not-exist" err &&
1173 + test_grep "fatal: update $c: invalid <old-oid>: does-not-exist" err &&
1174 test_must_fail git rev-parse --verify -q $c
1175 '
1176
@@ -1176,7 +1179,7 @@ test_expect_success 'stdin -z create ref fails when ref exists' '
1179 git rev-parse "$c" >expect &&
1180 printf $F "create $c" "$m~1" >stdin &&
1181 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1179 - grep "fatal: cannot lock ref '"'"'$c'"'"'" err &&
1182 + test_grep "fatal: cannot lock ref '"'"'$c'"'"'" err &&
1183 git rev-parse "$c" >actual &&
1184 test_cmp expect actual
1185 '
@@ -1185,28 +1188,28 @@ test_expect_success 'stdin -z create ref fails with bad new value' '
1188 git update-ref -d "$c" &&
1189 printf $F "create $c" "does-not-exist" >stdin &&
1190 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1188 - grep "fatal: create $c: invalid <new-oid>: does-not-exist" err &&
1191 + test_grep "fatal: create $c: invalid <new-oid>: does-not-exist" err &&
1192 test_must_fail git rev-parse --verify -q $c
1193 '
1194
1195 test_expect_success 'stdin -z create ref fails with empty new value' '
1196 printf $F "create $c" "" >stdin &&
1197 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1195 - grep "fatal: create $c: missing <new-oid>" err &&
1198 + test_grep "fatal: create $c: missing <new-oid>" err &&
1199 test_must_fail git rev-parse --verify -q $c
1200 '
1201
1202 test_expect_success 'stdin -z create ref fails with non commit object' '
1203 printf $F "create $c" "$(test_oid 001)" >stdin &&
1204 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1202 - grep "fatal: trying to write ref ${SQ}$c${SQ} with nonexistent object" err &&
1205 + test_grep "fatal: trying to write ref ${SQ}$c${SQ} with nonexistent object" err &&
1206 test_must_fail git rev-parse --verify -q $c
1207 '
1208
1209 test_expect_success 'stdin -z update ref fails with non commit object' '
1210 printf $F "update $b" "$(test_oid 001)" "" >stdin &&
1211 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1209 - grep "fatal: trying to write ref ${SQ}$b${SQ} with nonexistent object" err &&
1212 + test_grep "fatal: trying to write ref ${SQ}$b${SQ} with nonexistent object" err &&
1213 test_must_fail git rev-parse --verify -q $c
1214 '
1215
@@ -1221,7 +1224,7 @@ test_expect_success 'stdin -z update ref works with right old value' '
1224 test_expect_success 'stdin -z delete ref fails with wrong old value' '
1225 printf $F "delete $a" "$m~1" >stdin &&
1226 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1224 - grep "fatal: cannot lock ref '"'"'$a'"'"'" err &&
1227 + test_grep "fatal: cannot lock ref '"'"'$a'"'"'" err &&
1228 git rev-parse $m >expect &&
1229 git rev-parse $a >actual &&
1230 test_cmp expect actual
@@ -1230,7 +1233,7 @@ test_expect_success 'stdin -z delete ref fails with wrong old value' '
1233 test_expect_success 'stdin -z delete ref fails with zero old value' '
1234 printf $F "delete $a" "$Z" >stdin &&
1235 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1233 - grep "fatal: delete $a: zero <old-oid>" err &&
1236 + test_grep "fatal: delete $a: zero <old-oid>" err &&
1237 git rev-parse $m >expect &&
1238 git rev-parse $a >actual &&
1239 test_cmp expect actual
@@ -1336,7 +1339,7 @@ test_expect_success 'stdin -z update refs fails with wrong old value' '
1339 git update-ref $c $m &&
1340 printf $F "update $a" "$m" "$m" "update $b" "$m" "$m" "update $c" "$m" "$Z" >stdin &&
1341 test_must_fail git update-ref -z --stdin <stdin 2>err &&
1339 - grep "fatal: cannot lock ref '"'"'$c'"'"'" err &&
1342 + test_grep "fatal: cannot lock ref '"'"'$c'"'"'" err &&
1343 git rev-parse $m >expect &&
1344 git rev-parse $a >actual &&
1345 test_cmp expect actual &&
@@ -1415,13 +1418,13 @@ test_expect_success 'handle per-worktree refs in refs/bisect' '
1418 cd worktree &&
1419 git commit --allow-empty -m "test commit" &&
1420 git for-each-ref >for-each-ref.out &&
1418 - ! grep refs/bisect for-each-ref.out &&
1421 + test_grep ! refs/bisect for-each-ref.out &&
1422 git update-ref refs/bisect/something HEAD &&
1423 git rev-parse refs/bisect/something >../worktree-head &&
1424 git for-each-ref | grep refs/bisect/something
1425 ) &&
1426 git show-ref >actual &&
1424 - ! grep 'refs/bisect' actual &&
1427 + test_grep ! 'refs/bisect' actual &&
1428 test_must_fail git rev-parse refs/bisect/something &&
1429 git update-ref refs/bisect/something HEAD &&
1430 git rev-parse refs/bisect/something >main-head &&
@@ -1477,7 +1480,7 @@ test_expect_success 'transaction exits on multiple aborts' '
1480 test_must_fail git update-ref --stdin <stdin >actual 2>err &&
1481 printf "%s: ok\n" abort >expect &&
1482 test_cmp expect actual &&
1480 - grep "fatal: transaction is closed" err
1483 + test_grep "fatal: transaction is closed" err
1484 '
1485
1486 test_expect_success 'transaction exits on start after prepare' '
@@ -1488,7 +1491,7 @@ test_expect_success 'transaction exits on start after prepare' '
1491 test_must_fail git update-ref --stdin <stdin 2>err >actual &&
1492 printf "%s: ok\n" prepare >expect &&
1493 test_cmp expect actual &&
1491 - grep "fatal: prepared transactions can only be closed" err
1494 + test_grep "fatal: prepared transactions can only be closed" err
1495 '
1496
1497 test_expect_success 'transaction handles empty abort with missing prepare' '
@@ -1648,7 +1651,7 @@ test_expect_success PIPE 'transaction flushes status updates' '
1651
1652 # This must now fail given that we have locked the ref.
1653 test_must_fail git update-ref refs/heads/flush $B 2>stderr &&
1651 - grep "fatal: update_ref failed for ref ${SQ}refs/heads/flush${SQ}: cannot lock ref" stderr &&
1654 + test_grep "fatal: update_ref failed for ref ${SQ}refs/heads/flush${SQ}: cannot lock ref" stderr &&
1655
1656 echo commit >&9 &&
1657 echo "commit: ok" >expected &&
@@ -1674,7 +1677,7 @@ do
1677 git symbolic-ref refs/heads/symref $a &&
1678 format_command $type "symref-verify refs/heads/symref" "$a" >stdin &&
1679 test_must_fail git update-ref --stdin $type <stdin 2>err &&
1677 - grep "fatal: symref-verify: cannot operate with deref mode" err
1680 + test_grep "fatal: symref-verify: cannot operate with deref mode" err
1681 '
1682
1683 test_expect_success "stdin $type symref-verify fails with too many arguments" '
@@ -1682,9 +1685,9 @@ do
1685 test_must_fail git update-ref --stdin $type --no-deref <stdin 2>err &&
1686 if test "$type" = "-z"
1687 then
1685 - grep "fatal: unknown command: $a" err
1688 + test_grep "fatal: unknown command: $a" err
1689 else
1687 - grep "fatal: symref-verify refs/heads/symref: extra input: $a" err
1690 + test_grep "fatal: symref-verify refs/heads/symref: extra input: $a" err
1691 fi
1692 '
1693
@@ -1717,7 +1720,7 @@ do
1720 test-tool ref-store main for-each-reflog-ent refs/heads/symref >before &&
1721 format_command $type "symref-verify refs/heads/missing" "refs/heads/unknown" >stdin &&
1722 test_must_fail git update-ref --stdin $type --no-deref <stdin 2>err &&
1720 - grep "fatal: cannot lock ref ${SQ}refs/heads/missing${SQ}: unable to resolve reference ${SQ}refs/heads/missing${SQ}" err &&
1723 + test_grep "fatal: cannot lock ref ${SQ}refs/heads/missing${SQ}: unable to resolve reference ${SQ}refs/heads/missing${SQ}" err &&
1724 test_must_fail git rev-parse --verify -q refs/heads/missing &&
1725 test-tool ref-store main for-each-reflog-ent refs/heads/symref >after &&
1726 test_cmp before after
@@ -1743,13 +1746,13 @@ do
1746 git symbolic-ref refs/heads/symref $a &&
1747 format_command $type "symref-delete refs/heads/symref" "$a" >stdin &&
1748 test_must_fail git update-ref --stdin $type <stdin 2>err &&
1746 - grep "fatal: symref-delete: cannot operate with deref mode" err
1749 + test_grep "fatal: symref-delete: cannot operate with deref mode" err
1750 '
1751
1752 test_expect_success "stdin $type symref-delete fails with no ref" '
1753 format_command $type "symref-delete " >stdin &&
1754 test_must_fail git update-ref --stdin $type --no-deref <stdin 2>err &&
1752 - grep "fatal: symref-delete: missing <ref>" err
1755 + test_grep "fatal: symref-delete: missing <ref>" err
1756 '
1757
1758 test_expect_success "stdin $type symref-delete fails deleting regular ref" '
@@ -1757,7 +1760,7 @@ do
1760 git update-ref refs/heads/regularref $a &&
1761 format_command $type "symref-delete refs/heads/regularref" "$a" >stdin &&
1762 test_must_fail git update-ref --stdin $type --no-deref <stdin 2>err &&
1760 - grep "fatal: cannot lock ref ${SQ}refs/heads/regularref${SQ}: expected symref with target ${SQ}$a${SQ}: but is a regular ref" err
1763 + test_grep "fatal: cannot lock ref ${SQ}refs/heads/regularref${SQ}: expected symref with target ${SQ}$a${SQ}: but is a regular ref" err
1764 '
1765
1766 test_expect_success "stdin $type symref-delete fails with too many arguments" '
@@ -1765,16 +1768,16 @@ do
1768 test_must_fail git update-ref --stdin $type --no-deref <stdin 2>err &&
1769 if test "$type" = "-z"
1770 then
1768 - grep "fatal: unknown command: $a" err
1771 + test_grep "fatal: unknown command: $a" err
1772 else
1770 - grep "fatal: symref-delete refs/heads/symref: extra input: $a" err
1773 + test_grep "fatal: symref-delete refs/heads/symref: extra input: $a" err
1774 fi
1775 '
1776
1777 test_expect_success "stdin $type symref-delete fails with wrong old value" '
1778 format_command $type "symref-delete refs/heads/symref" "$m" >stdin &&
1779 test_must_fail git update-ref --stdin $type --no-deref <stdin 2>err &&
1777 - grep "fatal: verifying symref target: ${SQ}refs/heads/symref${SQ}: is at $a but expected refs/heads/main" err &&
1780 + test_grep "fatal: verifying symref target: ${SQ}refs/heads/symref${SQ}: is at $a but expected refs/heads/main" err &&
1781 git symbolic-ref refs/heads/symref >expect &&
1782 echo $a >actual &&
1783 test_cmp expect actual
@@ -1812,9 +1815,9 @@ do
1815 test_must_fail git update-ref --stdin $type --no-deref <stdin 2>err &&
1816 if test "$type" = "-z"
1817 then
1815 - grep "fatal: unknown command: $a" err
1818 + test_grep "fatal: unknown command: $a" err
1819 else
1817 - grep "fatal: symref-create refs/heads/symref: extra input: $a" err
1820 + test_grep "fatal: symref-create refs/heads/symref: extra input: $a" err
1821 fi
1822 '
1823
@@ -1877,16 +1880,16 @@ do
1880 test_must_fail git update-ref --stdin $type --no-deref <stdin 2>err &&
1881 if test "$type" = "-z"
1882 then
1880 - grep "fatal: unknown command: $a" err
1883 + test_grep "fatal: unknown command: $a" err
1884 else
1882 - grep "fatal: symref-update refs/heads/symref: extra input: $a" err
1885 + test_grep "fatal: symref-update refs/heads/symref: extra input: $a" err
1886 fi
1887 '
1888
1889 test_expect_success "stdin $type symref-update fails with wrong old value argument" '
1890 format_command $type "symref-update refs/heads/symref" "$a" "foo" "$a" "$a" >stdin &&
1891 test_must_fail git update-ref --stdin $type --no-deref <stdin 2>err &&
1889 - grep "fatal: symref-update refs/heads/symref: invalid arg ${SQ}foo${SQ} for old value" err
1892 + test_grep "fatal: symref-update refs/heads/symref: invalid arg ${SQ}foo${SQ} for old value" err
1893 '
1894
1895 test_expect_success "stdin $type symref-update creates with zero old value" '
@@ -1922,7 +1925,7 @@ do
1925 git symbolic-ref refs/heads/symref $a &&
1926 format_command $type "symref-update refs/heads/symref" "$m" "ref" "$b" >stdin &&
1927 test_must_fail git update-ref --stdin $type --no-deref <stdin 2>err &&
1925 - grep "fatal: verifying symref target: ${SQ}refs/heads/symref${SQ}: is at $a but expected $b" err &&
1928 + test_grep "fatal: verifying symref target: ${SQ}refs/heads/symref${SQ}: is at $a but expected $b" err &&
1929 test_must_fail git rev-parse --verify -q $c
1930 '
1931
@@ -1997,7 +2000,7 @@ do
2000 git symbolic-ref --no-recurse refs/heads/symref >actual &&
2001 test_cmp expect actual &&
2002 test-tool ref-store main for-each-reflog-ent refs/heads/symref >actual &&
2000 - grep "$Z $(git rev-parse $a)" actual
2003 + test_grep "$Z $(git rev-parse $a)" actual
2004 '
2005
2006 test_expect_success "stdin $type symref-update regular ref to symref with correct old-oid" '
@@ -2009,7 +2012,7 @@ do
2012 git symbolic-ref --no-recurse refs/heads/regularref >actual &&
2013 test_cmp expect actual &&
2014 test-tool ref-store main for-each-reflog-ent refs/heads/regularref >actual &&
2012 - grep "$(git rev-parse $a) $(git rev-parse $a)" actual
2015 + test_grep "$(git rev-parse $a) $(git rev-parse $a)" actual
2016 '
2017
2018 test_expect_success "stdin $type symref-update regular ref to symref fails with wrong old-oid" '
@@ -2017,7 +2020,7 @@ do
2020 git update-ref --no-deref refs/heads/regularref $a &&
2021 format_command $type "symref-update refs/heads/regularref" "$a" "oid" "$(git rev-parse refs/heads/target2)" >stdin &&
2022 test_must_fail git update-ref --stdin $type <stdin 2>err &&
2020 - grep "fatal: cannot lock ref ${SQ}refs/heads/regularref${SQ}: is at $(git rev-parse $a) but expected $(git rev-parse refs/heads/target2)" err &&
2023 + test_grep "fatal: cannot lock ref ${SQ}refs/heads/regularref${SQ}: is at $(git rev-parse $a) but expected $(git rev-parse refs/heads/target2)" err &&
2024 echo $(git rev-parse $a) >expect &&
2025 git rev-parse refs/heads/regularref >actual &&
2026 test_cmp expect actual
@@ -2028,7 +2031,7 @@ do
2031 git update-ref --no-deref refs/heads/regularref $a &&
2032 format_command $type "symref-update refs/heads/regularref" "$a" "oid" "not-a-ref-oid" >stdin &&
2033 test_must_fail git update-ref --stdin $type <stdin 2>err &&
2031 - grep "fatal: symref-update refs/heads/regularref: invalid oid: not-a-ref-oid" err &&
2034 + test_grep "fatal: symref-update refs/heads/regularref: invalid oid: not-a-ref-oid" err &&
2035 echo $(git rev-parse $a) >expect &&
2036 git rev-parse refs/heads/regularref >actual &&
2037 test_cmp expect actual
@@ -2039,7 +2042,7 @@ do
2042 git symbolic-ref refs/heads/symref refs/heads/target2 &&
2043 format_command $type "symref-update refs/heads/symref" "$a" "oid" "$Z" >stdin &&
2044 test_must_fail git update-ref --stdin $type <stdin 2>err &&
2042 - grep "fatal: cannot lock ref ${SQ}refs/heads/symref${SQ}: reference already exists" err &&
2045 + test_grep "fatal: cannot lock ref ${SQ}refs/heads/symref${SQ}: reference already exists" err &&
2046 echo refs/heads/target2 >expect &&
2047 git symbolic-ref refs/heads/symref >actual &&
2048 test_cmp expect actual
@@ -2059,7 +2062,7 @@ do
2062 git symbolic-ref --no-recurse refs/heads/symref >actual &&
2063 test_cmp expect actual &&
2064 test-tool ref-store main for-each-reflog-ent refs/heads/symref >actual &&
2062 - grep "$(git rev-parse $a) $(git rev-parse $a)" actual
2065 + test_grep "$(git rev-parse $a) $(git rev-parse $a)" actual
2066 '
2067
2068 test_expect_success "stdin $type symref-update regular ref to symref" '
@@ -2071,7 +2074,7 @@ do
2074 git symbolic-ref --no-recurse refs/heads/regularref >actual &&
2075 test_cmp expect actual &&
2076 test-tool ref-store main for-each-reflog-ent refs/heads/regularref >actual &&
2074 - grep "$(git rev-parse $a) $(git rev-parse $a)" actual
2077 + test_grep "$(git rev-parse $a) $(git rev-parse $a)" actual
2078 '
2079
2080 test_expect_success "stdin $type batch-updates" '
t/t1403-show-ref.sh
+9 -9
@@ -213,19 +213,19 @@ test_expect_success 'show-ref --verify with dangling ref' '
213
214 test_expect_success 'show-ref sub-modes are mutually exclusive' '
215 test_must_fail git show-ref --verify --exclude-existing 2>err &&
216 - grep "verify" err &&
217 - grep "exclude-existing" err &&
218 - grep "cannot be used together" err &&
216 + test_grep "verify" err &&
217 + test_grep "exclude-existing" err &&
218 + test_grep "cannot be used together" err &&
219
220 test_must_fail git show-ref --verify --exists 2>err &&
221 - grep "verify" err &&
222 - grep "exists" err &&
223 - grep "cannot be used together" err &&
221 + test_grep "verify" err &&
222 + test_grep "exists" err &&
223 + test_grep "cannot be used together" err &&
224
225 test_must_fail git show-ref --exclude-existing --exists 2>err &&
226 - grep "exclude-existing" err &&
227 - grep "exists" err &&
228 - grep "cannot be used together" err
226 + test_grep "exclude-existing" err &&
227 + test_grep "exists" err &&
228 + test_grep "cannot be used together" err
229 '
230
231 test_done
t/t1410-reflog.sh
+2 -2
@@ -108,12 +108,12 @@ test_expect_success setup '
108
109 test_expect_success 'correct usage on sub-command -h' '
110 test_expect_code 129 git reflog expire -h >err &&
111 - grep "git reflog expire" err
111 + test_grep "git reflog expire" err
112 '
113
114 test_expect_success 'correct usage on "git reflog show -h"' '
115 test_expect_code 129 git reflog show -h >err &&
116 - grep -F "git reflog [show]" err
116 + test_grep -F "git reflog [show]" err
117 '
118
119 test_expect_success 'pass through -- to sub-command' '
t/t1415-worktree-refs.sh
+2 -2
@@ -32,7 +32,7 @@ test_expect_success 'ambiguous main-worktree/HEAD' '
32 test_when_finished git update-ref -d refs/heads/main-worktree/HEAD &&
33 git update-ref refs/heads/main-worktree/HEAD $(git rev-parse HEAD) &&
34 git rev-parse main-worktree/HEAD 2>warn &&
35 - grep "main-worktree/HEAD.*ambiguous" warn
35 + test_grep "main-worktree/HEAD.*ambiguous" warn
36 '
37
38 test_expect_success 'resolve worktrees/xx/HEAD' '
@@ -45,7 +45,7 @@ test_expect_success 'ambiguous worktrees/xx/HEAD' '
45 git update-ref refs/heads/worktrees/wt1/HEAD $(git rev-parse HEAD) &&
46 test_when_finished git update-ref -d refs/heads/worktrees/wt1/HEAD &&
47 git rev-parse worktrees/wt1/HEAD 2>warn &&
48 - grep "worktrees/wt1/HEAD.*ambiguous" warn
48 + test_grep "worktrees/wt1/HEAD.*ambiguous" warn
49 '
50
51 test_expect_success 'reflog of main-worktree/HEAD' '
t/t1430-bad-ref-name.sh
+28 -28
@@ -47,7 +47,7 @@ test_expect_success 'git branch shows badly named ref as warning' '
47 test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
48 git branch >output 2>error &&
49 test_grep -e "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
50 - ! grep -e "broken\.\.\.ref" output
50 + test_grep ! -e "broken\.\.\.ref" output
51 '
52
53 test_expect_success 'branch -d can delete badly named ref' '
@@ -55,8 +55,8 @@ test_expect_success 'branch -d can delete badly named ref' '
55 test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
56 git branch -d broken...ref &&
57 git branch >output 2>error &&
58 - ! grep -e "broken\.\.\.ref" error &&
59 - ! grep -e "broken\.\.\.ref" output
58 + test_grep ! -e "broken\.\.\.ref" error &&
59 + test_grep ! -e "broken\.\.\.ref" output
60 '
61
62 test_expect_success 'branch -D can delete badly named ref' '
@@ -64,8 +64,8 @@ test_expect_success 'branch -D can delete badly named ref' '
64 test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
65 git branch -D broken...ref &&
66 git branch >output 2>error &&
67 - ! grep -e "broken\.\.\.ref" error &&
68 - ! grep -e "broken\.\.\.ref" output
67 + test_grep ! -e "broken\.\.\.ref" error &&
68 + test_grep ! -e "broken\.\.\.ref" output
69 '
70
71 test_expect_success 'branch -D cannot delete non-ref in .git dir' '
@@ -93,8 +93,8 @@ test_expect_success 'git branch cannot create a badly named ref' '
93 test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
94 test_must_fail git branch broken...ref &&
95 git branch >output 2>error &&
96 - ! grep -e "broken\.\.\.ref" error &&
97 - ! grep -e "broken\.\.\.ref" output
96 + test_grep ! -e "broken\.\.\.ref" error &&
97 + test_grep ! -e "broken\.\.\.ref" output
98 '
99
100 test_expect_success 'branch -m cannot rename to a bad ref name' '
@@ -104,8 +104,8 @@ test_expect_success 'branch -m cannot rename to a bad ref name' '
104 test_must_fail git branch -m goodref broken...ref &&
105 test_cmp_rev main goodref &&
106 git branch >output 2>error &&
107 - ! grep -e "broken\.\.\.ref" error &&
108 - ! grep -e "broken\.\.\.ref" output
107 + test_grep ! -e "broken\.\.\.ref" error &&
108 + test_grep ! -e "broken\.\.\.ref" output
109 '
110
111 test_expect_failure 'branch -m can rename from a bad ref name' '
@@ -115,16 +115,16 @@ test_expect_failure 'branch -m can rename from a bad ref name' '
115 git branch -m broken...ref renamed &&
116 test_cmp_rev main renamed &&
117 git branch >output 2>error &&
118 - ! grep -e "broken\.\.\.ref" error &&
119 - ! grep -e "broken\.\.\.ref" output
118 + test_grep ! -e "broken\.\.\.ref" error &&
119 + test_grep ! -e "broken\.\.\.ref" output
120 '
121
122 test_expect_success 'push cannot create a badly named ref' '
123 test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
124 test_must_fail git push "file://$(pwd)" HEAD:refs/heads/broken...ref &&
125 git branch >output 2>error &&
126 - ! grep -e "broken\.\.\.ref" error &&
127 - ! grep -e "broken\.\.\.ref" output
126 + test_grep ! -e "broken\.\.\.ref" error &&
127 + test_grep ! -e "broken\.\.\.ref" output
128 '
129
130 test_expect_failure 'push --mirror can delete badly named ref' '
@@ -144,8 +144,8 @@ test_expect_failure 'push --mirror can delete badly named ref' '
144 ) &&
145 git -C src push --mirror "file://$top/dest" &&
146 git -C dest branch >output 2>error &&
147 - ! grep -e "broken\.\.\.ref" error &&
148 - ! grep -e "broken\.\.\.ref" output
147 + test_grep ! -e "broken\.\.\.ref" error &&
148 + test_grep ! -e "broken\.\.\.ref" output
149 '
150
151 test_expect_success 'rev-parse skips symref pointing to broken name' '
@@ -168,9 +168,9 @@ test_expect_success 'for-each-ref emits warnings for broken names' '
168 test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/main &&
169 test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
170 git for-each-ref >output 2>error &&
171 - ! grep -e "broken\.\.\.ref" output &&
172 - ! grep -e "badname" output &&
173 - ! grep -e "broken\.\.\.symref" output &&
171 + test_grep ! -e "broken\.\.\.ref" output &&
172 + test_grep ! -e "badname" output &&
173 + test_grep ! -e "broken\.\.\.symref" output &&
174 test_grep "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
175 test_grep ! "ignoring broken ref refs/heads/badname" error &&
176 test_grep "ignoring ref with broken name refs/heads/broken\.\.\.symref" error
@@ -183,8 +183,8 @@ test_expect_success 'update-ref -d can delete broken name' '
183 test_must_be_empty output &&
184 test_must_be_empty error &&
185 git branch >output 2>error &&
186 - ! grep -e "broken\.\.\.ref" error &&
187 - ! grep -e "broken\.\.\.ref" output
186 + test_grep ! -e "broken\.\.\.ref" error &&
187 + test_grep ! -e "broken\.\.\.ref" output
188 '
189
190 test_expect_success 'branch -d can delete broken name' '
@@ -194,8 +194,8 @@ test_expect_success 'branch -d can delete broken name' '
194 test_grep "Deleted branch broken...ref (was broken)" output &&
195 test_must_be_empty error &&
196 git branch >output 2>error &&
197 - ! grep -e "broken\.\.\.ref" error &&
198 - ! grep -e "broken\.\.\.ref" output
197 + test_grep ! -e "broken\.\.\.ref" error &&
198 + test_grep ! -e "broken\.\.\.ref" output
199 '
200
201 test_expect_success 'update-ref --no-deref -d can delete symref to broken name' '
@@ -313,37 +313,37 @@ test_expect_success 'update-ref -d cannot delete absolute path' '
313 test_expect_success 'update-ref --stdin fails create with bad ref name' '
314 echo "create ~a refs/heads/main" >stdin &&
315 test_must_fail git update-ref --stdin <stdin 2>err &&
316 - grep "fatal: invalid ref format: ~a" err
316 + test_grep "fatal: invalid ref format: ~a" err
317 '
318
319 test_expect_success 'update-ref --stdin fails update with bad ref name' '
320 echo "update ~a refs/heads/main" >stdin &&
321 test_must_fail git update-ref --stdin <stdin 2>err &&
322 - grep "fatal: invalid ref format: ~a" err
322 + test_grep "fatal: invalid ref format: ~a" err
323 '
324
325 test_expect_success 'update-ref --stdin fails delete with bad ref name' '
326 echo "delete ~a refs/heads/main" >stdin &&
327 test_must_fail git update-ref --stdin <stdin 2>err &&
328 - grep "fatal: invalid ref format: ~a" err
328 + test_grep "fatal: invalid ref format: ~a" err
329 '
330
331 test_expect_success 'update-ref --stdin -z fails create with bad ref name' '
332 printf "%s\0" "create ~a " refs/heads/main >stdin &&
333 test_must_fail git update-ref -z --stdin <stdin 2>err &&
334 - grep "fatal: invalid ref format: ~a " err
334 + test_grep "fatal: invalid ref format: ~a " err
335 '
336
337 test_expect_success 'update-ref --stdin -z fails update with bad ref name' '
338 printf "%s\0" "update ~a" refs/heads/main "" >stdin &&
339 test_must_fail git update-ref -z --stdin <stdin 2>err &&
340 - grep "fatal: invalid ref format: ~a" err
340 + test_grep "fatal: invalid ref format: ~a" err
341 '
342
343 test_expect_success 'update-ref --stdin -z fails delete with bad ref name' '
344 printf "%s\0" "delete ~a" refs/heads/main >stdin &&
345 test_must_fail git update-ref -z --stdin <stdin 2>err &&
346 - grep "fatal: invalid ref format: ~a" err
346 + test_grep "fatal: invalid ref format: ~a" err
347 '
348
349 test_expect_success 'branch rejects HEAD as a branch name' '
t/t1450-fsck.sh
+6 -6
@@ -68,7 +68,7 @@ test_expect_success 'object with hash mismatch' '
68 git update-ref refs/heads/bogus $cmt &&
69
70 test_must_fail git fsck 2>out &&
71 - grep "$oldoid: hash-path mismatch, found at: .*$new" out
71 + test_grep "$oldoid: hash-path mismatch, found at: .*$new" out
72 )
73 '
74
@@ -172,7 +172,7 @@ test_expect_success 'commit with multiple signatures is okay' '
172 test_when_finished "git update-ref -d refs/heads/bogus" &&
173 git fsck 2>out &&
174 cat out &&
175 - ! grep "commit $new" out
175 + test_grep ! "commit $new" out
176 '
177
178 test_expect_success 'email without @ is okay' '
@@ -183,7 +183,7 @@ test_expect_success 'email without @ is okay' '
183 git update-ref refs/heads/bogus "$new" &&
184 test_when_finished "git update-ref -d refs/heads/bogus" &&
185 git fsck 2>out &&
186 - ! grep "commit $new" out
186 + test_grep ! "commit $new" out
187 '
188
189 test_expect_success 'email with embedded > is not okay' '
@@ -626,7 +626,7 @@ test_expect_success 'fsck notices excessively large tree entry name' '
626 cd large-name &&
627 test_commit a-long-name &&
628 git -c fsck.largePathname=warn:10 fsck 2>out &&
629 - grep "warning.*large pathname" out
629 + test_grep "warning.*large pathname" out
630 )
631 '
632
@@ -849,7 +849,7 @@ test_expect_success 'fsck errors in packed objects' '
849 test_must_fail git fsck 2>out &&
850 test_grep "error in commit $one.* - bad name" out &&
851 test_grep "error in commit $two.* - bad name" out &&
852 - ! grep corrupt out
852 + test_grep ! corrupt out
853 '
854
855 test_expect_success 'fsck handles multiple packfiles with big blobs' '
@@ -1027,7 +1027,7 @@ test_expect_success 'bogus head does not fallback to all heads' '
1027 test_when_finished "git rm --cached foo" &&
1028 remove_object $blob &&
1029 test_must_fail git fsck $ZERO_OID >out 2>&1 &&
1030 - ! grep $blob out
1030 + test_grep ! $blob out
1031 '
1032
1033 # Corrupt the checksum on the index.
t/t1451-fsck-buffer.sh
+3 -3
@@ -46,7 +46,7 @@ check () {
46 echo "$content"
47 } >input &&
48 test_must_fail git hash-object -t "$type" input 2>err &&
49 - grep "$fsck" err
49 + test_grep "$fsck" err
50 '
51 }
52
@@ -125,7 +125,7 @@ ident_checks tag tagger
125 test_expect_success 'truncated tree (short hash)' '
126 printf "100644 foo\0\1\1\1\1" >input &&
127 test_must_fail git hash-object -t tree input 2>err &&
128 - grep badTree err
128 + test_grep badTree err
129 '
130
131 test_expect_success 'truncated tree (missing nul)' '
@@ -135,7 +135,7 @@ test_expect_success 'truncated tree (missing nul)' '
135 # parser does not walk past the end of the buffer).
136 printf "100644 a long filename, or a hash with missing nul?" >input &&
137 test_must_fail git hash-object -t tree input 2>err &&
138 - grep badTree err
138 + test_grep badTree err
139 '
140
141 test_done
t/t1460-refs-migrate.sh
+1 -1
@@ -212,7 +212,7 @@ do
212 test_commit -C repo initial &&
213 git -C repo refs migrate --dry-run \
214 --ref-format=$to_format >output &&
215 - grep "Finished dry-run migration of refs" output &&
215 + test_grep "Finished dry-run migration of refs" output &&
216 test_path_is_dir repo/.git/ref_migration.* &&
217 echo $from_format >expect &&
218 git -C repo rev-parse --show-ref-format >actual &&
t/t1500-rev-parse.sh
+3 -3
@@ -204,7 +204,7 @@ test_expect_success 'rev-parse --show-object-format in repo' '
204 git rev-parse --show-object-format=output >actual &&
205 test_cmp expect actual &&
206 test_must_fail git rev-parse --show-object-format=squeamish-ossifrage 2>err &&
207 - grep "unknown mode for --show-object-format: squeamish-ossifrage" err
207 + test_grep "unknown mode for --show-object-format: squeamish-ossifrage" err
208 '
209
210
@@ -228,7 +228,7 @@ test_expect_success RUST 'rev-parse --show-object-format in repo with compat mod
228 git rev-parse --show-object-format=compat >actual &&
229 test_cmp expect actual &&
230 test_must_fail git rev-parse --show-object-format=squeamish-ossifrage 2>err &&
231 - grep "unknown mode for --show-object-format: squeamish-ossifrage" err
231 + test_grep "unknown mode for --show-object-format: squeamish-ossifrage" err
232 ) &&
233 mkdir repo2 &&
234 (
@@ -254,7 +254,7 @@ test_expect_success 'rev-parse --show-ref-format with invalid storage' '
254 cd repo &&
255 git config extensions.refstorage broken &&
256 test_must_fail git rev-parse --show-ref-format 2>err &&
257 - grep "error: invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}broken${SQ}" err
257 + test_grep "error: invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}broken${SQ}" err
258 )
259 '
260
t/t1502-rev-parse-parseopt.sh
+1 -1
@@ -331,7 +331,7 @@ test_expect_success 'ambiguous: --no matches both --noble and --no-noble' '
331 EOF
332 test_expect_code 129 env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \
333 git rev-parse --parseopt -- <spec 2>err --no &&
334 - grep "error: ambiguous option: no (could be --noble or --no-noble)" err
334 + test_grep "error: ambiguous option: no (could be --noble or --no-noble)" err
335 '
336
337 test_done
t/t1503-rev-parse-verify.sh
+5 -5
@@ -62,15 +62,15 @@ test_expect_success 'works with one good rev' '
62
63 test_expect_success 'fails with any bad rev or many good revs' '
64 test_must_fail git rev-parse --verify 2>error &&
65 - grep "single revision" error &&
65 + test_grep "single revision" error &&
66 test_must_fail git rev-parse --verify foo 2>error &&
67 - grep "single revision" error &&
67 + test_grep "single revision" error &&
68 test_must_fail git rev-parse --verify HEAD bar 2>error &&
69 - grep "single revision" error &&
69 + test_grep "single revision" error &&
70 test_must_fail git rev-parse --verify baz HEAD 2>error &&
71 - grep "single revision" error &&
71 + test_grep "single revision" error &&
72 test_must_fail git rev-parse --verify $HASH2 HEAD 2>error &&
73 - grep "single revision" error
73 + test_grep "single revision" error
74 '
75
76 test_expect_success 'fails silently when using -q' '
t/t1510-repo-setup.sh
+5 -5
@@ -604,7 +604,7 @@ test_expect_success '#20b/c: core.worktree and core.bare conflict' '
604 cd 20b/.git &&
605 test_must_fail git status >/dev/null
606 ) 2>message &&
607 - grep "core.bare and core.worktree" message
607 + test_grep "core.bare and core.worktree" message
608 '
609
610 test_expect_success '#20d: core.worktree and core.bare OK when working tree not needed' '
@@ -721,8 +721,8 @@ test_expect_success '#22.2: core.worktree and core.bare conflict' '
721 export GIT_DIR &&
722 test_must_fail git status 2>result
723 ) &&
724 - grep "core.bare and core.worktree" 22/.git/result &&
725 - grep "core.bare and core.worktree" 22/result
724 + test_grep "core.bare and core.worktree" 22/.git/result &&
725 + test_grep "core.bare and core.worktree" 22/result
726 '
727
728 # Case #23: GIT_DIR + GIT_WORK_TREE(+core.worktree) suppresses bareness.
@@ -767,7 +767,7 @@ test_expect_success '#28: core.worktree and core.bare conflict (gitfile case)' '
767 cd 28 &&
768 test_must_fail git status
769 ) 2>message &&
770 - grep "core.bare and core.worktree" message
770 + test_grep "core.bare and core.worktree" message
771 '
772
773 # Case #29: GIT_WORK_TREE(+core.worktree) overrides core.bare (gitfile case).
@@ -791,7 +791,7 @@ test_expect_success '#30: core.worktree and core.bare conflict (gitfile version)
791 cd 30 &&
792 test_must_fail env GIT_DIR=.git git status 2>result
793 ) &&
794 - grep "core.bare and core.worktree" 30/result
794 + test_grep "core.bare and core.worktree" 30/result
795 '
796
797 # Case #31: GIT_DIR + GIT_WORK_TREE(+core.worktree) suppresses
t/t1512-rev-parse-disambiguation.sh
+2 -2
@@ -378,7 +378,7 @@ test_expect_success 'ambiguous 40-hex ref' '
378 VAL=$(git commit-tree $TREE </dev/null) &&
379 git update-ref refs/heads/$REF $VAL &&
380 test $(git rev-parse $REF 2>err) = $REF &&
381 - grep "refname.*${REF}.*ambiguous" err
381 + test_grep "refname.*${REF}.*ambiguous" err
382 '
383
384 test_expect_success 'ambiguous short sha1 ref' '
@@ -387,7 +387,7 @@ test_expect_success 'ambiguous short sha1 ref' '
387 VAL=$(git commit-tree $TREE </dev/null) &&
388 git update-ref refs/heads/$REF $VAL &&
389 test $(git rev-parse $REF 2>err) = $VAL &&
390 - grep "refname.*${REF}.*ambiguous" err
390 + test_grep "refname.*${REF}.*ambiguous" err
391 '
392
393 test_expect_success 'ambiguity errors are not repeated (raw)' '
t/t1515-rev-parse-outside-repo.sh
+1 -1
@@ -32,7 +32,7 @@ test_expect_success 'rev-parse --local-env-vars' '
32 git rev-parse --local-env-vars >actual &&
33 # we do not want to depend on the complete list here,
34 # so just look for something plausible
35 - grep ^GIT_DIR actual
35 + test_grep ^GIT_DIR actual
36 '
37
38 test_expect_success 'rev-parse --resolve-git-dir' '
t/t1800-hook.sh
+9 -9
@@ -79,7 +79,7 @@ test_expect_success 'git hook usage' '
79 test_expect_code 129 git hook run --unknown 2>err &&
80 test_expect_code 129 git hook list &&
81 test_expect_code 129 git hook list -h &&
82 - grep "unknown option" err
82 + test_grep "unknown option" err
83 '
84
85 test_expect_success 'git hook list: unknown hook name is rejected' '
@@ -361,9 +361,9 @@ test_expect_success 'hook can be configured for multiple events' '
361
362 # 'ghi' should be included in both 'pre-commit' and 'test-hook'
363 git hook list pre-commit >actual &&
364 - grep "ghi" actual &&
364 + test_grep "ghi" actual &&
365 git hook list --allow-unknown-hook-name test-hook >actual &&
366 - grep "ghi" actual
366 + test_grep "ghi" actual
367 '
368
369 test_expect_success 'git hook list shows hooks from the hookdir' '
@@ -569,7 +569,7 @@ test_expect_success 'git hook run a hook with a bad shebang' '
569 # TODO: We should emit the same (or at least a more similar)
570 # error on MINGW (essentially Git for Windows) and all other
571 # platforms.. See the OS-specific code in start_command()
572 - grep -E "^(error|fatal): cannot (exec|spawn) .*bad-hooks/test-hook" err
572 + test_grep -E "^(error|fatal): cannot (exec|spawn) .*bad-hooks/test-hook" err
573 '
574
575 test_expect_success 'stdin to hooks' '
@@ -826,8 +826,8 @@ test_expect_success 'git hook run -j2 warns for hooks not marked parallel=true'
826 # neither hook has parallel=true
827
828 git hook run --allow-unknown-hook-name -j2 test-hook >out 2>err &&
829 - grep "hook .hook-1. is not marked as parallel=true" err &&
830 - grep "hook .hook-2. is not marked as parallel=true" err
829 + test_grep "hook .hook-1. is not marked as parallel=true" err &&
830 + test_grep "hook .hook-2. is not marked as parallel=true" err
831 '
832
833 test_expect_success 'hook.jobs=1 config runs hooks in series' '
@@ -1068,7 +1068,7 @@ test_expect_success 'hook.jobs=-1 resolves to online_cpus()' '
1068 cpus=$(test-tool online-cpus) &&
1069 GIT_TRACE2_EVENT="$(pwd)/trace.txt" \
1070 git hook run --allow-unknown-hook-name test-hook >out 2>err &&
1071 - grep "\"region_enter\".*\"hook\".*\"test-hook\".*\"max:$cpus\"" trace.txt
1071 + test_grep "\"region_enter\".*\"hook\".*\"test-hook\".*\"max:$cpus\"" trace.txt
1072 '
1073
1074 test_expect_success 'hook.<event>.jobs=-1 resolves to online_cpus()' '
@@ -1081,7 +1081,7 @@ test_expect_success 'hook.<event>.jobs=-1 resolves to online_cpus()' '
1081 cpus=$(test-tool online-cpus) &&
1082 GIT_TRACE2_EVENT="$(pwd)/trace.txt" \
1083 git hook run --allow-unknown-hook-name test-hook >out 2>err &&
1084 - grep "\"region_enter\".*\"hook\".*\"test-hook\".*\"max:$cpus\"" trace.txt
1084 + test_grep "\"region_enter\".*\"hook\".*\"test-hook\".*\"max:$cpus\"" trace.txt
1085 '
1086
1087 test_expect_success 'git hook run -j-1 resolves to online_cpus()' '
@@ -1092,7 +1092,7 @@ test_expect_success 'git hook run -j-1 resolves to online_cpus()' '
1092 cpus=$(test-tool online-cpus) &&
1093 GIT_TRACE2_EVENT="$(pwd)/trace.txt" \
1094 git hook run --allow-unknown-hook-name -j-1 test-hook >out 2>err &&
1095 - grep "\"region_enter\".*\"hook\".*\"test-hook\".*\"max:$cpus\"" trace.txt
1095 + test_grep "\"region_enter\".*\"hook\".*\"test-hook\".*\"max:$cpus\"" trace.txt
1096 '
1097
1098 test_expect_success 'hook.jobs rejects values less than -1' '
t/t2004-checkout-cache-temp.sh
+2 -2
@@ -132,8 +132,8 @@ test_expect_success 'overriding --stage=all resets implied --temp' '
132 test_expect_success '--stage=all --no-temp is rejected' '
133 rm -f path* .merge_* actual &&
134 test_must_fail git checkout-index --stage=all --no-temp -- path1 2>err &&
135 - grep -v "already exists" err &&
136 - grep "options .--stage=all. and .--no-temp. cannot be used together" err
135 + test_grep -v "already exists" err &&
136 + test_grep "options .--stage=all. and .--no-temp. cannot be used together" err
137 '
138
139 test_expect_success 'checkout some stages/one file to temporary files' '
t/t2019-checkout-ambiguous-ref.sh
+2 -2
@@ -19,7 +19,7 @@ test_expect_success 'checkout ambiguous ref succeeds' '
19 '
20
21 test_expect_success 'checkout produces ambiguity warning' '
22 - grep "warning.*ambiguous" stderr
22 + test_grep "warning.*ambiguous" stderr
23 '
24
25 test_expect_success 'checkout chooses branch over tag' '
@@ -41,7 +41,7 @@ test_expect_success 'checkout vague ref succeeds' '
41 '
42
43 test_expect_success VAGUENESS_SUCCESS 'checkout produces ambiguity warning' '
44 - grep "warning.*ambiguous" stderr
44 + test_grep "warning.*ambiguous" stderr
45 '
46
47 test_expect_success VAGUENESS_SUCCESS 'checkout chooses branch over tag' '
t/t2024-checkout-dwim.sh
+4 -4
@@ -311,7 +311,7 @@ test_expect_success 'loosely defined local base branch is reported correctly' '
311 git checkout loose >actual.raw 2>&1 &&
312 sed -e "s/loose/BRANCHNAME/g" <actual.raw >actual &&
313 status_uno_is_clean &&
314 - grep BRANCHNAME actual &&
314 + test_grep BRANCHNAME actual &&
315
316 test_cmp expect actual
317 '
@@ -324,7 +324,7 @@ test_expect_success 'reject when arg could be part of dwim branch' '
324 echo bar >dwim-arg &&
325 test_must_fail git checkout dwim-arg &&
326 test_must_fail git rev-parse refs/heads/dwim-arg -- &&
327 - grep bar dwim-arg
327 + test_grep bar dwim-arg
328 '
329
330 test_expect_success 'disambiguate dwim branch and checkout path (1)' '
@@ -334,7 +334,7 @@ test_expect_success 'disambiguate dwim branch and checkout path (1)' '
334 echo bar >dwim-arg1 &&
335 git checkout -- dwim-arg1 &&
336 test_must_fail git rev-parse refs/heads/dwim-arg1 -- &&
337 - grep foo dwim-arg1
337 + test_grep foo dwim-arg1
338 '
339
340 test_expect_success 'disambiguate dwim branch and checkout path (2)' '
@@ -344,7 +344,7 @@ test_expect_success 'disambiguate dwim branch and checkout path (2)' '
344 echo bar >dwim-arg2 &&
345 git checkout dwim-arg2 -- &&
346 git rev-parse refs/heads/dwim-arg2 -- &&
347 - grep bar dwim-arg2
347 + test_grep bar dwim-arg2
348 '
349
350 test_done
t/t2030-unresolve-info.sh
+3 -3
@@ -122,7 +122,7 @@ test_expect_success 'add records checkout -m undoes' '
122 check_resolve_undo removed &&
123 echo the index and the work tree is unmerged again &&
124 git diff >actual &&
125 - grep "^++<<<<<<<" actual
125 + test_grep "^++<<<<<<<" actual
126 '
127
128 test_expect_success 'unmerge with plumbing' '
@@ -173,7 +173,7 @@ test_expect_success 'rerere and rerere forget' '
173 test -f .git/rr-cache/$rerere_id/postimage &&
174 git checkout -m fi/le &&
175 echo resurrect the conflict &&
176 - grep "^=======" fi/le &&
176 + test_grep "^=======" fi/le &&
177 echo reresolve the conflict &&
178 git rerere &&
179 test "z$(cat fi/le)" = zdifferent &&
@@ -199,7 +199,7 @@ test_expect_success 'rerere and rerere forget (subdirectory)' '
199 test -f .git/rr-cache/$rerere_id/postimage &&
200 (cd fi && git checkout -m le) &&
201 echo resurrect the conflict &&
202 - grep "^=======" fi/le &&
202 + test_grep "^=======" fi/le &&
203 echo reresolve the conflict &&
204 (cd fi && git rerere) &&
205 test "z$(cat fi/le)" = zdifferent &&
t/t2060-switch.sh
+3 -3
@@ -34,13 +34,13 @@ test_expect_success 'switch and detach' '
34
35 test_expect_success 'suggestion to detach' '
36 test_must_fail git switch main^{commit} 2>stderr &&
37 - grep "try again with the --detach option" stderr
37 + test_grep "try again with the --detach option" stderr
38 '
39
40 test_expect_success 'suggestion to detach is suppressed with advice.suggestDetachingHead=false' '
41 test_config advice.suggestDetachingHead false &&
42 test_must_fail git switch main^{commit} 2>stderr &&
43 - ! grep "try again with the --detach option" stderr
43 + test_grep ! "try again with the --detach option" stderr
44 '
45
46 test_expect_success 'switch and detach current branch' '
@@ -76,7 +76,7 @@ test_expect_success 'new orphan branch from empty' '
76 git switch --orphan new-orphan &&
77 test_commit orphan &&
78 git cat-file commit refs/heads/new-orphan >commit &&
79 - ! grep ^parent commit &&
79 + test_grep ! ^parent commit &&
80 git ls-files >tracked-files &&
81 echo orphan.t >expected &&
82 test_cmp expected tracked-files
t/t2070-restore.sh
+1 -1
@@ -216,7 +216,7 @@ test_expect_success 'restore with merge options are incompatible with certain op
216 "--staged --worktree --conflict=zdiff3"
217 do
218 test_must_fail git restore $opts . 2>err &&
219 - grep "cannot be used" err || return
219 + test_grep "cannot be used" err || return
220 done
221 '
222
t/t2080-parallel-checkout-basics.sh
+7 -7
@@ -200,13 +200,13 @@ test_expect_success 'parallel checkout respects --[no]-force' '
200 # We expect 0 workers because there is nothing to be done
201 test_checkout_workers 0 git checkout HEAD &&
202 test_path_is_file D &&
203 - grep changed D &&
204 - grep changed F.t &&
203 + test_grep changed D &&
204 + test_grep changed F.t &&
205
206 test_checkout_workers 2 git checkout --force HEAD &&
207 test_path_is_dir D &&
208 - grep D/F D/F.t &&
209 - grep F F.t
208 + test_grep D/F D/F.t &&
209 + test_grep F F.t
210 )
211 '
212
@@ -224,8 +224,8 @@ test_expect_success SYMLINKS 'parallel checkout checks for symlinks in leading d
224
225 test_checkout_workers 2 git checkout --force HEAD &&
226 ! test -h D &&
227 - grep D/A D/A.t &&
228 - grep D/B D/B.t
227 + test_grep D/A D/A.t &&
228 + test_grep D/B D/B.t
229 )
230 '
231
@@ -268,7 +268,7 @@ test_expect_success '"git checkout ." report should not include failed entries'
268 # - missing-delay.a: the delay filter will drop this path
269 # - parallel-*.a: the blob will be missing
270 #
271 - grep "Updated 3 paths from the index" err &&
271 + test_grep "Updated 3 paths from the index" err &&
272 test_stdout_line_count = 3 ls *.b &&
273 ! ls *.a
274 )
t/t2081-parallel-checkout-collisions.sh
+12 -12
@@ -78,8 +78,8 @@ test_expect_success CASE_INSENSITIVE_FS 'worker detects dirname collision' '
78
79 # Check that it used the right number of workers and detected the collisions
80 test_workers_in_event_trace 2 trace &&
81 - grep "category.:.pcheckout.,.key.:.collision/dirname.,.value.:.A/B.}" trace &&
82 - grep "category.:.pcheckout.,.key.:.collision/dirname.,.value.:.A/C.}" trace
81 + test_grep "category.:.pcheckout.,.key.:.collision/dirname.,.value.:.A/B.}" trace &&
82 + test_grep "category.:.pcheckout.,.key.:.collision/dirname.,.value.:.A/C.}" trace
83 '
84
85 test_expect_success SYMLINKS,CASE_INSENSITIVE_FS 'do not follow symlinks colliding with leading dir' '
@@ -115,11 +115,11 @@ test_expect_success CASE_INSENSITIVE_FS 'collision report on clone (w/ racy file
115 set_checkout_config 2 0 &&
116 test_checkout_workers 2 git clone . clone-repo 2>stderr &&
117
118 - grep FILE_X stderr &&
119 - grep FILE_x stderr &&
120 - grep file_X stderr &&
121 - grep file_x stderr &&
122 - grep "the following paths have collided" stderr
118 + test_grep FILE_X stderr &&
119 + test_grep FILE_x stderr &&
120 + test_grep file_X stderr &&
121 + test_grep file_x stderr &&
122 + test_grep "the following paths have collided" stderr
123 '
124
125 # This test ensures that the collision report code is correctly looking for
@@ -148,11 +148,11 @@ test_expect_success CASE_INSENSITIVE_FS,!MINGW,!CYGWIN \
148 test_checkout_workers 2 \
149 git -c core.ignoreCase=false clone . clone-repo 2>stderr &&
150
151 - grep FILE_X stderr &&
152 - grep FILE_x stderr &&
153 - grep file_X stderr &&
154 - grep file_x stderr &&
155 - grep "the following paths have collided" stderr &&
151 + test_grep FILE_X stderr &&
152 + test_grep FILE_x stderr &&
153 + test_grep file_X stderr &&
154 + test_grep file_x stderr &&
155 + test_grep "the following paths have collided" stderr &&
156
157 # Check that only "file_x" was filtered
158 echo file_x >expected.log &&
t/t2082-parallel-checkout-attributes.sh
+6 -6
@@ -28,8 +28,8 @@ test_expect_success 'parallel-checkout with ident' '
28 rm A B &&
29 test_checkout_workers 2 git reset --hard &&
30 hexsz=$(test_oid hexsz) &&
31 - grep -E "\\\$Id: [0-9a-f]{$hexsz} \\\$" A &&
32 - grep "\\\$Id\\\$" B
31 + test_grep -E "\\\$Id: [0-9a-f]{$hexsz} \\\$" A &&
32 + test_grep "\\\$Id\\\$" B
33 )
34 '
35
@@ -175,15 +175,15 @@ test_expect_success 'parallel-checkout and delayed checkout' '
175 verify_checkout delayed &&
176
177 # Check that the *.d files got to the delay queue and were filtered
178 - grep "smudge W.d .* \[DELAYED\]" delayed.log &&
179 - grep "smudge X.d .* \[DELAYED\]" delayed.log &&
178 + test_grep "smudge W.d .* \[DELAYED\]" delayed.log &&
179 + test_grep "smudge X.d .* \[DELAYED\]" delayed.log &&
180 test_cmp delayed/W.d original &&
181 test_cmp delayed/X.d original &&
182
183 # Check that the parallel-eligible entries went to the right queue and
184 # were not filtered
185 - ! grep "smudge Y .* \[DELAYED\]" delayed.log &&
186 - ! grep "smudge Z .* \[DELAYED\]" delayed.log &&
185 + test_grep ! "smudge Y .* \[DELAYED\]" delayed.log &&
186 + test_grep ! "smudge Z .* \[DELAYED\]" delayed.log &&
187 test_cmp delayed/Y original &&
188 test_cmp delayed/Z original
189 '
t/t2103-update-index-ignore-missing.sh
+3 -3
@@ -63,9 +63,9 @@ test_expect_success '--unmerged --refresh' '
63 git update-index --unmerged --refresh &&
64 echo 2 >two &&
65 test_must_fail git update-index --unmerged --refresh >actual &&
66 - grep two actual &&
67 - ! grep one actual &&
68 - ! grep three actual
66 + test_grep two actual &&
67 + test_grep ! one actual &&
68 + test_grep ! three actual
69 '
70
71 test_expect_success '--ignore-submodules --refresh (1)' '
t/t2200-add-update.sh
+1 -1
@@ -241,7 +241,7 @@ test_expect_success 'add -u avoids rename pairing on unmerged paths' '
241 test_expect_success '"add -u non-existent" should fail' '
242 test_must_fail git add -u non-existent &&
243 git ls-files >actual &&
244 - ! grep "non-existent" actual
244 + test_grep ! "non-existent" actual
245 '
246
247 test_expect_success '"commit -a" implies "add -u" if index becomes empty' '
t/t2203-add-intent.sh
+3 -3
@@ -57,7 +57,7 @@ test_expect_success 'intent to add does not clobber existing paths' '
57 git add -N file elif &&
58 empty=$(git hash-object --stdin </dev/null) &&
59 git ls-files -s >actual &&
60 - ! grep "$empty" actual
60 + test_grep ! "$empty" actual
61 '
62
63 test_expect_success 'i-t-a entry is simply ignored' '
@@ -124,7 +124,7 @@ test_expect_success 'cache-tree does not ignore dir that has i-t-a entries' '
124 git add -N 2/1 &&
125 git commit -m committed &&
126 git ls-tree -r HEAD >actual &&
127 - grep 2/2 actual
127 + test_grep 2/2 actual
128 )
129 '
130
@@ -312,7 +312,7 @@ test_expect_success 'apply --intent-to-add' '
312 echo new >new-ita &&
313 git add -N new-ita &&
314 git diff >expected &&
315 - grep "new file" expected &&
315 + test_grep "new file" expected &&
316 git reset --hard &&
317 git apply --intent-to-add expected &&
318 git diff >actual &&
t/t2400-worktree-add.sh
+12 -12
@@ -122,7 +122,7 @@ test_expect_success 'die the same branch is already checked out' '
122 (
123 cd here &&
124 test_must_fail git checkout newmain 2>actual &&
125 - grep "already used by worktree at" actual
125 + test_grep "already used by worktree at" actual
126 )
127 '
128
@@ -139,7 +139,7 @@ test_expect_success 'refuse to reset a branch in use elsewhere' '
139 git rev-parse --verify refs/heads/newmain >new.branch &&
140 git rev-parse --verify HEAD >new.head &&
141
142 - grep "already used by worktree at" error &&
142 + test_grep "already used by worktree at" error &&
143 test_cmp old.branch new.branch &&
144 test_cmp old.head new.head &&
145
@@ -328,7 +328,7 @@ test_wt_add_excl () {
328 local opts="$*" &&
329 test_expect_success "'worktree add' with '$opts' has mutually exclusive options" '
330 test_must_fail git worktree add $opts 2>actual &&
331 - grep -E "fatal:( options)? .* cannot be used together" actual
331 + test_grep -E "fatal:( options)? .* cannot be used together" actual
332 '
333 }
334
@@ -436,13 +436,13 @@ test_wt_add_orphan_hint () {
436 (cd repo && test_commit commit) &&
437 git -C repo switch --orphan noref &&
438 test_must_fail git -C repo worktree add $opts foobar/ 2>actual &&
439 - ! grep "error: unknown switch" actual &&
440 - grep "hint: If you meant to create a worktree containing a new unborn branch" actual &&
439 + test_grep ! "error: unknown switch" actual &&
440 + test_grep "hint: If you meant to create a worktree containing a new unborn branch" actual &&
441 if [ $use_branch -eq 1 ]
442 then
443 - grep -E "^hint: +git worktree add --orphan -b [^ ]+ [^ ]+$" actual
443 + test_grep -E "^hint: +git worktree add --orphan -b [^ ]+ [^ ]+$" actual
444 else
445 - grep -E "^hint: +git worktree add --orphan [^ ]+$" actual
445 + test_grep -E "^hint: +git worktree add --orphan [^ ]+$" actual
446 fi
447
448 '
@@ -457,8 +457,8 @@ test_expect_success "'worktree add' doesn't show orphan hint in bad/orphan HEAD
457 git init repo &&
458 (cd repo && test_commit commit) &&
459 test_must_fail git -C repo worktree add --quiet foobar_branch foobar/ 2>actual &&
460 - ! grep "error: unknown switch" actual &&
461 - ! grep "hint: If you meant to create a worktree containing a new unborn branch" actual
460 + test_grep ! "error: unknown switch" actual &&
461 + test_grep ! "hint: If you meant to create a worktree containing a new unborn branch" actual
462 '
463
464 test_expect_success 'local clone from linked checkout' '
@@ -469,7 +469,7 @@ test_expect_success 'local clone from linked checkout' '
469 test_expect_success 'local clone --shared from linked checkout' '
470 git -C bare worktree add --detach ../baretree &&
471 git clone --local --shared baretree bare-clone &&
472 - grep /bare/ bare-clone/.git/objects/info/alternates
472 + test_grep /bare/ bare-clone/.git/objects/info/alternates
473 '
474
475 test_expect_success '"add" worktree with --no-checkout' '
@@ -491,7 +491,7 @@ test_expect_success 'put a worktree under rebase' '
491 set_fake_editor &&
492 FAKE_LINES="edit 1" git rebase -i HEAD^ &&
493 git worktree list >actual &&
494 - grep "under-rebase.*detached HEAD" actual
494 + test_grep "under-rebase.*detached HEAD" actual
495 )
496 '
497
@@ -533,7 +533,7 @@ test_expect_success 'checkout a branch under bisect' '
533 git bisect bad &&
534 git bisect good HEAD~2 &&
535 git worktree list >actual &&
536 - grep "under-bisect.*detached HEAD" actual &&
536 + test_grep "under-bisect.*detached HEAD" actual &&
537 test_must_fail git worktree add new-bisect under-bisect &&
538 test_path_is_missing new-bisect
539 )
t/t2402-worktree-list.sh
+8 -8
@@ -101,8 +101,8 @@ test_expect_success '"list" all worktrees with locked annotation' '
101 git worktree lock locked &&
102 test_when_finished "git worktree unlock locked" &&
103 git worktree list >out &&
104 - grep "/locked *[0-9a-f].* locked$" out &&
105 - ! grep "/unlocked *[0-9a-f].* locked$" out
104 + test_grep "/locked *[0-9a-f].* locked$" out &&
105 + test_grep ! "/unlocked *[0-9a-f].* locked$" out
106 '
107
108 test_expect_success '"list" all worktrees --porcelain with locked' '
@@ -143,8 +143,8 @@ test_expect_success '"list" all worktrees with prunable annotation' '
143 git worktree add --detach unprunable &&
144 rm -rf prunable &&
145 git worktree list >out &&
146 - grep "/prunable *[0-9a-f].* prunable$" out &&
147 - ! grep "/unprunable *[0-9a-f].* prunable$" out
146 + test_grep "/prunable *[0-9a-f].* prunable$" out &&
147 + test_grep ! "/unprunable *[0-9a-f].* prunable$" out
148 '
149
150 test_expect_success '"list" all worktrees --porcelain with prunable' '
@@ -162,8 +162,8 @@ test_expect_success '"list" all worktrees with prunable consistent with "prune"'
162 git worktree add --detach unprunable &&
163 rm -rf prunable &&
164 git worktree list >out &&
165 - grep "/prunable *[0-9a-f].* prunable$" out &&
166 - ! grep "/unprunable *[0-9a-f].* unprunable$" out &&
165 + test_grep "/prunable *[0-9a-f].* prunable$" out &&
166 + test_grep ! "/unprunable *[0-9a-f].* unprunable$" out &&
167 git worktree prune --verbose 2>out &&
168 test_grep "^Removing worktrees/prunable" out &&
169 test_grep ! "^Removing worktrees/unprunable" out
@@ -184,7 +184,7 @@ test_expect_success '"list" all worktrees --verbose with locked' '
184 echo "$(git -C locked2 rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >expect &&
185 printf "\tlocked: with reason\n" >>expect &&
186 git worktree list --verbose >out &&
187 - grep "/locked1 *[0-9a-f].* locked$" out &&
187 + test_grep "/locked1 *[0-9a-f].* locked$" out &&
188 sed -n "s/ */ /g;/\/locked2 *[0-9a-f].*$/,/locked: .*$/p" <out >actual &&
189 test_cmp actual expect
190 '
@@ -266,7 +266,7 @@ test_expect_success 'broken main worktree still at the top' '
266 test_cmp ../expected actual &&
267 git worktree list >out &&
268 head -n 1 out >actual.2 &&
269 - grep -F "(error)" actual.2
269 + test_grep -F "(error)" actual.2
270 )
271 '
272
t/t2403-worktree-move.sh
+3 -3
@@ -75,8 +75,8 @@ test_expect_success 'move worktree' '
75 git worktree move source destination &&
76 test_path_is_missing source &&
77 git worktree list --porcelain >out &&
78 - grep "^worktree.*/destination$" out &&
79 - ! grep "^worktree.*/source$" out &&
78 + test_grep "^worktree.*/destination$" out &&
79 + test_grep ! "^worktree.*/source$" out &&
80 git -C destination log --format=%s >actual2 &&
81 echo init >expected2 &&
82 test_cmp expected2 actual2
@@ -92,7 +92,7 @@ test_expect_success 'move worktree to another dir' '
92 test_when_finished "git worktree move some-dir/destination destination" &&
93 test_path_is_missing destination &&
94 git worktree list --porcelain >out &&
95 - grep "^worktree.*/some-dir/destination$" out &&
95 + test_grep "^worktree.*/some-dir/destination$" out &&
96 git -C some-dir/destination log --format=%s >actual2 &&
97 echo init >expected2 &&
98 test_cmp expected2 actual2
t/t2405-worktree-submodule.sh
+3 -3
@@ -36,7 +36,7 @@ test_expect_success 'add superproject worktree' '
36
37 test_expect_failure 'submodule is checked out just after worktree add' '
38 git -C worktree diff --submodule main"^!" >out &&
39 - grep "file1 updated" out
39 + test_grep "file1 updated" out
40 '
41
42 test_expect_success 'add superproject worktree and initialize submodules' '
@@ -46,7 +46,7 @@ test_expect_success 'add superproject worktree and initialize submodules' '
46
47 test_expect_success 'submodule is checked out just after submodule update in linked worktree' '
48 git -C worktree-submodule-update diff --submodule main"^!" >out &&
49 - grep "file1 updated" out
49 + test_grep "file1 updated" out
50 '
51
52 test_expect_success 'add superproject worktree and manually add submodule worktree' '
@@ -56,7 +56,7 @@ test_expect_success 'add superproject worktree and manually add submodule worktr
56
57 test_expect_success 'submodule is checked out after manually adding submodule worktree' '
58 git -C linked_submodule diff --submodule main"^!" >out &&
59 - grep "file1 updated" out
59 + test_grep "file1 updated" out
60 '
61
62 test_expect_success 'checkout --recurse-submodules uses $GIT_DIR for submodules in a linked worktree' '
t/t2407-worktree-heads.sh
+13 -13
@@ -41,10 +41,10 @@ test_expect_success 'refuse to overwrite: checked out in worktree' '
41 for i in 1 2 3 4
42 do
43 test_must_fail git branch -f wt-$i HEAD 2>err &&
44 - grep "cannot force update the branch" err &&
44 + test_grep "cannot force update the branch" err &&
45
46 test_must_fail git branch -D wt-$i 2>err &&
47 - grep "cannot delete branch" err || return 1
47 + test_grep "cannot delete branch" err || return 1
48 done
49 '
50
@@ -57,7 +57,7 @@ test_expect_success 'refuse to overwrite: worktree in bisect' '
57 git -C wt-4 bisect good wt-1 &&
58
59 test_must_fail git branch -f wt-4 HEAD 2>err &&
60 - grep "cannot force update the branch '\''wt-4'\'' used by worktree at.*wt-4" err
60 + test_grep "cannot force update the branch '\''wt-4'\'' used by worktree at.*wt-4" err
61 '
62
63 test_expect_success 'refuse to overwrite: worktree in rebase (apply)' '
@@ -67,7 +67,7 @@ test_expect_success 'refuse to overwrite: worktree in rebase (apply)' '
67 test_must_fail git -C wt-2 rebase --apply conflict-2 &&
68
69 test_must_fail git branch -f wt-2 HEAD 2>err &&
70 - grep "cannot force update the branch '\''wt-2'\'' used by worktree at.*wt-2" err
70 + test_grep "cannot force update the branch '\''wt-2'\'' used by worktree at.*wt-2" err
71 '
72
73 test_expect_success 'refuse to overwrite: worktree in rebase (merge)' '
@@ -77,7 +77,7 @@ test_expect_success 'refuse to overwrite: worktree in rebase (merge)' '
77 test_must_fail git -C wt-2 rebase conflict-2 &&
78
79 test_must_fail git branch -f wt-2 HEAD 2>err &&
80 - grep "cannot force update the branch '\''wt-2'\'' used by worktree at.*wt-2" err
80 + test_grep "cannot force update the branch '\''wt-2'\'' used by worktree at.*wt-2" err
81 '
82
83 test_expect_success 'refuse to overwrite: worktree in rebase with --update-refs' '
@@ -89,19 +89,19 @@ test_expect_success 'refuse to overwrite: worktree in rebase with --update-refs'
89 for i in 3 4
90 do
91 test_must_fail git branch -f can-be-updated HEAD 2>err &&
92 - grep "cannot force update the branch '\''can-be-updated'\'' used by worktree at.*wt-3" err ||
92 + test_grep "cannot force update the branch '\''can-be-updated'\'' used by worktree at.*wt-3" err ||
93 return 1
94 done
95 '
96
97 test_expect_success 'refuse to fetch over ref: checked out' '
98 test_must_fail git fetch server +refs/heads/wt-3:refs/heads/wt-3 2>err &&
99 - grep "refusing to fetch into branch '\''refs/heads/wt-3'\''" err &&
99 + test_grep "refusing to fetch into branch '\''refs/heads/wt-3'\''" err &&
100
101 # General fetch into refs/heads/ will fail on first ref,
102 # so use a generic error message check.
103 test_must_fail git fetch server +refs/heads/*:refs/heads/* 2>err &&
104 - grep "refusing to fetch into branch" err
104 + test_grep "refusing to fetch into branch" err
105 '
106
107 test_expect_success 'refuse to fetch over ref: worktree in bisect' '
@@ -113,7 +113,7 @@ test_expect_success 'refuse to fetch over ref: worktree in bisect' '
113 git -C wt-4 bisect good wt-1 &&
114
115 test_must_fail git fetch server +refs/heads/wt-4:refs/heads/wt-4 2>err &&
116 - grep "refusing to fetch into branch" err
116 + test_grep "refusing to fetch into branch" err
117 '
118
119 test_expect_success 'refuse to fetch over ref: worktree in rebase' '
@@ -123,7 +123,7 @@ test_expect_success 'refuse to fetch over ref: worktree in rebase' '
123 test_must_fail git -C wt-3 rebase conflict-3 &&
124
125 test_must_fail git fetch server +refs/heads/wt-3:refs/heads/wt-3 2>err &&
126 - grep "refusing to fetch into branch" err
126 + test_grep "refusing to fetch into branch" err
127 '
128
129 test_expect_success 'refuse to overwrite when in error states' '
@@ -149,7 +149,7 @@ test_expect_success 'refuse to overwrite when in error states' '
149 for i in 1 2
150 do
151 test_must_fail git branch -f fake-$i HEAD 2>err &&
152 - grep "cannot force update the branch '\''fake-$i'\'' used by worktree at" err ||
152 + test_grep "cannot force update the branch '\''fake-$i'\'' used by worktree at" err ||
153 return 1
154 done
155 '
@@ -161,13 +161,13 @@ test_expect_success 'refuse to overwrite during rebase with --update-refs' '
161 (
162 set_cat_todo_editor &&
163 test_must_fail git rebase -i --update-refs HEAD~3 >todo &&
164 - ! grep "update-refs" todo
164 + test_grep ! "update-refs" todo
165 ) &&
166 git branch -f allow-update HEAD~2 &&
167 (
168 set_cat_todo_editor &&
169 test_must_fail git rebase -i --update-refs HEAD~3 >todo &&
170 - grep "update-ref refs/heads/allow-update" todo
170 + test_grep "update-ref refs/heads/allow-update" todo
171 )
172 '
173
t/t2500-untracked-overwriting.sh
+4 -4
@@ -51,7 +51,7 @@ test_expect_success 'reset --merge will preserve untracked files/dirs' '
51
52 test_must_fail git reset --merge work 2>error &&
53 test_cmp expect foo.t/file &&
54 - grep "Updating .foo.t. would lose untracked files" error
54 + test_grep "Updating .foo.t. would lose untracked files" error
55 )
56 '
57
@@ -66,7 +66,7 @@ test_expect_success 'reset --keep will preserve untracked files/dirs' '
66
67 test_must_fail git reset --merge work 2>error &&
68 test_cmp expect foo.t/file &&
69 - grep "Updating.*foo.t.*would lose untracked files" error
69 + test_grep "Updating.*foo.t.*would lose untracked files" error
70 )
71 '
72
@@ -214,7 +214,7 @@ test_expect_success 'git am --abort and untracked dir vs. unmerged file' '
214
215 test_must_fail git am --abort 2>errors &&
216 test_path_is_dir filler &&
217 - grep "Updating .filler. would lose untracked files in it" errors
217 + test_grep "Updating .filler. would lose untracked files in it" errors
218 )
219 '
220
@@ -237,7 +237,7 @@ test_expect_success 'git am --skip and untracked dir vs deleted file' '
237 # Change our mind about resolutions, just skip this patch
238 test_must_fail git am --skip 2>errors &&
239 test_path_is_dir newfile &&
240 - grep "Updating .newfile. would lose untracked files in it" errors
240 + test_grep "Updating .newfile. would lose untracked files in it" errors
241 )
242 '
243
t/t2501-cwd-empty.sh
+2 -2
@@ -114,7 +114,7 @@ test_expect_success 'merge fails if cwd needs to be removed; recursive friendly'
114 ) &&
115
116 test_path_is_dir dirORfile &&
117 - grep "Refusing to remove the current working directory" error
117 + test_grep "Refusing to remove the current working directory" error
118 '
119
120 test_expect_success 'merge fails if cwd needs to be removed' '
@@ -179,7 +179,7 @@ test_incidental_untracked_dir_removal () {
179 test_expect_success 'clean does not remove cwd incidentally' '
180 test_incidental_untracked_dir_removal \
181 git -C .. clean -fd -e warnings . >warnings &&
182 - grep "Refusing to remove current working directory" warnings
182 + test_grep "Refusing to remove current working directory" warnings
183 '
184
185 test_expect_success 'stash does not remove cwd incidentally' '
t/t3001-ls-files-others-exclude.sh
+3 -3
@@ -161,21 +161,21 @@ test_expect_success 'trailing slash in exclude forces directory match (1)' '
161
162 >two &&
163 git ls-files --others --exclude=two/ >output &&
164 - grep "^two" output
164 + test_grep "^two" output
165
166 '
167
168 test_expect_success 'trailing slash in exclude forces directory match (2)' '
169
170 git ls-files --others --exclude=one/a.1/ >output &&
171 - grep "^one/a.1" output
171 + test_grep "^one/a.1" output
172
173 '
174
175 test_expect_success 'negated exclude matches can override previous ones' '
176
177 git ls-files --others --exclude="a.*" --exclude="!a.1" >output &&
178 - grep "^a.1" output
178 + test_grep "^a.1" output
179 '
180
181 test_expect_success 'excluded directory overrides content patterns' '
t/t3007-ls-files-recurse-submodules.sh
+3 -3
@@ -302,7 +302,7 @@ test_expect_success '--recurse-submodules does not support --error-unmatch' '
302 test_expect_success '--recurse-submodules parses submodule repo config' '
303 test_config -C submodule index.sparse "invalid non-boolean value" &&
304 test_must_fail git ls-files --recurse-submodules 2>err &&
305 - grep "bad boolean config value" err
305 + test_grep "bad boolean config value" err
306 '
307
308 test_expect_success '--recurse-submodules parses submodule worktree config' '
@@ -310,7 +310,7 @@ test_expect_success '--recurse-submodules parses submodule worktree config' '
310 test_config -C submodule --worktree index.sparse "invalid non-boolean value" &&
311
312 test_must_fail git ls-files --recurse-submodules 2>err &&
313 - grep "bad boolean config value" err
313 + test_grep "bad boolean config value" err
314 '
315
316 test_expect_success '--recurse-submodules submodules ignore super project worktreeConfig extension' '
@@ -329,7 +329,7 @@ test_expect_success '--recurse-submodules submodules ignore super project worktr
329 # With extensions.worktreeConfig disabled in the submodule, the invalid
330 # worktree config is not picked up.
331 git ls-files --recurse-submodules 2>err &&
332 - ! grep "bad boolean config value" err
332 + test_grep ! "bad boolean config value" err
333 '
334
335 test_incompatible_with_recurse_submodules () {
t/t3200-branch.sh
+6 -6
@@ -204,7 +204,7 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou
204
205 test_expect_success 'git branch -M baz bam should add entries to HEAD reflog' '
206 git reflog show HEAD >actual &&
207 - grep "HEAD@{0}: Branch: renamed refs/heads/baz to refs/heads/bam" actual
207 + test_grep "HEAD@{0}: Branch: renamed refs/heads/baz to refs/heads/bam" actual
208 '
209
210 test_expect_success 'git branch -M should leave orphaned HEAD alone' '
@@ -339,7 +339,7 @@ test_expect_success 'git branch -d on orphan HEAD (unmerged)' '
339 test_when_finished "git branch -D to-delete" &&
340 git branch to-delete main &&
341 test_must_fail git branch -d to-delete 2>err &&
342 - grep "not fully merged" err
342 + test_grep "not fully merged" err
343 '
344
345 test_expect_success 'git branch -d on orphan HEAD (unmerged, graph)' '
@@ -350,7 +350,7 @@ test_expect_success 'git branch -d on orphan HEAD (unmerged, graph)' '
350 test_when_finished "rm -rf .git/objects/commit-graph*" &&
351 git commit-graph write --reachable &&
352 test_must_fail git branch -d to-delete 2>err &&
353 - grep "not fully merged" err
353 + test_grep "not fully merged" err
354 '
355
356 test_expect_success 'git branch -v -d t should work' '
@@ -712,7 +712,7 @@ test_expect_success 'git branch -C c1 c2 should succeed when c1 is checked out'
712 test_expect_success 'git branch -C c1 c2 should never touch HEAD' '
713 msg="Branch: copied refs/heads/c1 to refs/heads/c2" &&
714 git reflog HEAD >actual &&
715 - ! grep "$msg$" actual
715 + test_grep ! "$msg$" actual
716 '
717
718 test_expect_success 'git branch -C main should work when main is checked out' '
@@ -930,7 +930,7 @@ test_expect_success 'deleting currently checked out branch fails' '
930 git worktree add -b my7 my7 &&
931 test_must_fail git -C my7 branch -d my7 &&
932 test_must_fail git branch -d my7 2>actual &&
933 - grep "^error: cannot delete branch .my7. used by worktree at " actual &&
933 + test_grep "^error: cannot delete branch .my7. used by worktree at " actual &&
934 rm -r my7 &&
935 git worktree prune
936 '
@@ -941,7 +941,7 @@ test_expect_success 'deleting in-use branch fails' '
941 git -C my7 bisect start HEAD HEAD~2 &&
942 test_must_fail git -C my7 branch -d my7 &&
943 test_must_fail git branch -d my7 2>actual &&
944 - grep "^error: cannot delete branch .my7. used by worktree at " actual &&
944 + test_grep "^error: cannot delete branch .my7. used by worktree at " actual &&
945 rm -r my7 &&
946 git worktree prune
947 '
t/t3202-show-branch.sh
+5 -5
@@ -123,13 +123,13 @@ test_expect_success 'show-branch --sparse' '
123 git commit --allow-empty -m "another" &&
124
125 git show-branch --sparse >out &&
126 - grep "merge 1 and 10 to make A" out &&
126 + test_grep "merge 1 and 10 to make A" out &&
127
128 git show-branch >out &&
129 - ! grep "merge 1 and 10 to make A" out &&
129 + test_grep ! "merge 1 and 10 to make A" out &&
130
131 git show-branch --no-sparse >out &&
132 - ! grep "merge 1 and 10 to make A" out
132 + test_grep ! "merge 1 and 10 to make A" out
133 '
134
135 test_expect_success 'setup show branch --list' '
@@ -189,7 +189,7 @@ while read combo
189 do
190 test_expect_success "show-branch $combo (should fail)" '
191 test_must_fail git show-branch $combo 2>error &&
192 - grep -e "cannot be used together" -e "usage:" error
192 + test_grep -e "cannot be used together" -e "usage:" error
193 '
194 done <<\EOF
195 --all --reflog
@@ -203,7 +203,7 @@ for opt in topo-order date-order reflog
203 do
204 test_expect_success "show-branch --no-$opt (should fail)" '
205 test_must_fail git show-branch --no-$opt 2>err &&
206 - grep "unknown option .no-$opt." err
206 + test_grep "unknown option .no-$opt." err
207 '
208 done
209
t/t3203-branch-output.sh
+2 -2
@@ -64,7 +64,7 @@ test_expect_success 'git branch -r shows remote branches' '
64
65 test_expect_success 'git branch --no-remotes is rejected' '
66 test_must_fail git branch --no-remotes 2>err &&
67 - grep "unknown option .no-remotes." err
67 + test_grep "unknown option .no-remotes." err
68 '
69
70 cat >expect <<'EOF'
@@ -85,7 +85,7 @@ test_expect_success 'git branch -a shows local and remote branches' '
85
86 test_expect_success 'git branch --no-all is rejected' '
87 test_must_fail git branch --no-all 2>err &&
88 - grep "unknown option .no-all." err
88 + test_grep "unknown option .no-all." err
89 '
90
91 cat >expect <<'EOF'
t/t3206-range-diff.sh
+39 -39
@@ -538,10 +538,10 @@ do
538 main..unmodified >actual &&
539 test_line_count = 5 actual &&
540 test_grep "^Range-diff:$" 0000-* &&
541 - grep "= 1: .* s/5/A" 0000-* &&
542 - grep "= 2: .* s/4/A" 0000-* &&
543 - grep "= 3: .* s/11/B" 0000-* &&
544 - grep "= 4: .* s/12/B" 0000-*
541 + test_grep "= 1: .* s/5/A" 0000-* &&
542 + test_grep "= 2: .* s/4/A" 0000-* &&
543 + test_grep "= 3: .* s/11/B" 0000-* &&
544 + test_grep "= 4: .* s/12/B" 0000-*
545 '
546 done
547
@@ -564,7 +564,7 @@ test_expect_success 'format-patch --range-diff as commentary' '
564 git format-patch --range-diff=HEAD~1 HEAD~1 >actual &&
565 test_line_count = 1 actual &&
566 test_grep "^Range-diff:$" 0001-* &&
567 - grep "> 1: .* new message" 0001-*
567 + test_grep "> 1: .* new message" 0001-*
568 '
569
570 test_expect_success 'format-patch --range-diff reroll-count with a non-integer' '
@@ -572,7 +572,7 @@ test_expect_success 'format-patch --range-diff reroll-count with a non-integer'
572 git format-patch --range-diff=HEAD~1 -v2.9 HEAD~1 >actual &&
573 test_line_count = 1 actual &&
574 test_grep "^Range-diff:$" v2.9-0001-* &&
575 - grep "> 1: .* new message" v2.9-0001-*
575 + test_grep "> 1: .* new message" v2.9-0001-*
576 '
577
578 test_expect_success 'format-patch --range-diff reroll-count with a integer' '
@@ -580,7 +580,7 @@ test_expect_success 'format-patch --range-diff reroll-count with a integer' '
580 git format-patch --range-diff=HEAD~1 -v2 HEAD~1 >actual &&
581 test_line_count = 1 actual &&
582 test_grep "^Range-diff ..* v1:$" v2-0001-* &&
583 - grep "> 1: .* new message" v2-0001-*
583 + test_grep "> 1: .* new message" v2-0001-*
584 '
585
586 test_expect_success 'format-patch --range-diff with v0' '
@@ -588,7 +588,7 @@ test_expect_success 'format-patch --range-diff with v0' '
588 git format-patch --range-diff=HEAD~1 -v0 HEAD~1 >actual &&
589 test_line_count = 1 actual &&
590 test_grep "^Range-diff:$" v0-0001-* &&
591 - grep "> 1: .* new message" v0-0001-*
591 + test_grep "> 1: .* new message" v0-0001-*
592 '
593
594 test_expect_success 'range-diff overrides diff.noprefix internally' '
@@ -686,8 +686,8 @@ test_expect_success 'range-diff with --notes=custom does not show default notes'
686 git notes --ref=custom add -m "unmodified note" unmodified &&
687 git range-diff --notes=custom main..topic main..unmodified \
688 >actual &&
689 - ! grep "## Notes ##" actual &&
690 - grep "## Notes (custom) ##" actual
689 + test_grep ! "## Notes ##" actual &&
690 + test_grep "## Notes (custom) ##" actual
691 '
692
693 test_expect_success 'format-patch --range-diff does not compare notes by default' '
@@ -699,12 +699,12 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
699 main..unmodified >actual &&
700 test_line_count = 5 actual &&
701 test_grep "^Range-diff:$" 0000-* &&
702 - grep "= 1: .* s/5/A" 0000-* &&
703 - grep "= 2: .* s/4/A" 0000-* &&
704 - grep "= 3: .* s/11/B" 0000-* &&
705 - grep "= 4: .* s/12/B" 0000-* &&
706 - ! grep "Notes" 0000-* &&
707 - ! grep "note" 0000-*
702 + test_grep "= 1: .* s/5/A" 0000-* &&
703 + test_grep "= 2: .* s/4/A" 0000-* &&
704 + test_grep "= 3: .* s/11/B" 0000-* &&
705 + test_grep "= 4: .* s/12/B" 0000-* &&
706 + test_grep ! "Notes" 0000-* &&
707 + test_grep ! "note" 0000-*
708 '
709
710 test_expect_success 'format-patch --notes=custom --range-diff --cover-letter only compares custom notes' '
@@ -717,8 +717,8 @@ test_expect_success 'format-patch --notes=custom --range-diff --cover-letter onl
717 test_when_finished "rm -f 000?-*" &&
718 git format-patch --notes=custom --cover-letter --range-diff=$prev \
719 main..unmodified >actual &&
720 - grep "## Notes (custom) ##" 0000-* &&
721 - ! grep "## Notes ##" 0000-*
720 + test_grep "## Notes (custom) ##" 0000-* &&
721 + test_grep ! "## Notes ##" 0000-*
722 '
723
724 # --range-diff on a single commit requires --no-cover-letter
@@ -744,12 +744,12 @@ test_expect_success 'format-patch --range-diff with --no-notes' '
744 main..unmodified >actual &&
745 test_line_count = 5 actual &&
746 test_grep "^Range-diff:$" 0000-* &&
747 - grep "= 1: .* s/5/A" 0000-* &&
748 - grep "= 2: .* s/4/A" 0000-* &&
749 - grep "= 3: .* s/11/B" 0000-* &&
750 - grep "= 4: .* s/12/B" 0000-* &&
751 - ! grep "Notes" 0000-* &&
752 - ! grep "note" 0000-*
747 + test_grep "= 1: .* s/5/A" 0000-* &&
748 + test_grep "= 2: .* s/4/A" 0000-* &&
749 + test_grep "= 3: .* s/11/B" 0000-* &&
750 + test_grep "= 4: .* s/12/B" 0000-* &&
751 + test_grep ! "Notes" 0000-* &&
752 + test_grep ! "note" 0000-*
753 '
754
755 test_expect_success 'format-patch --range-diff with --notes' '
@@ -761,10 +761,10 @@ test_expect_success 'format-patch --range-diff with --notes' '
761 main..unmodified >actual &&
762 test_line_count = 5 actual &&
763 test_grep "^Range-diff:$" 0000-* &&
764 - grep "= 1: .* s/5/A" 0000-* &&
765 - grep "= 2: .* s/4/A" 0000-* &&
766 - grep "= 3: .* s/11/B" 0000-* &&
767 - grep "! 4: .* s/12/B" 0000-* &&
764 + test_grep "= 1: .* s/5/A" 0000-* &&
765 + test_grep "= 2: .* s/4/A" 0000-* &&
766 + test_grep "= 3: .* s/11/B" 0000-* &&
767 + test_grep "! 4: .* s/12/B" 0000-* &&
768 sed s/Z/\ /g >expect <<-EOF &&
769 @@ Commit message
770 Z
@@ -790,10 +790,10 @@ test_expect_success 'format-patch --range-diff with format.notes config' '
790 main..unmodified >actual &&
791 test_line_count = 5 actual &&
792 test_grep "^Range-diff:$" 0000-* &&
793 - grep "= 1: .* s/5/A" 0000-* &&
794 - grep "= 2: .* s/4/A" 0000-* &&
795 - grep "= 3: .* s/11/B" 0000-* &&
796 - grep "! 4: .* s/12/B" 0000-* &&
793 + test_grep "= 1: .* s/5/A" 0000-* &&
794 + test_grep "= 2: .* s/4/A" 0000-* &&
795 + test_grep "= 3: .* s/11/B" 0000-* &&
796 + test_grep "! 4: .* s/12/B" 0000-* &&
797 sed s/Z/\ /g >expect <<-EOF &&
798 @@ Commit message
799 Z
@@ -821,10 +821,10 @@ test_expect_success 'format-patch --range-diff with multiple notes' '
821 main..unmodified >actual &&
822 test_line_count = 5 actual &&
823 test_grep "^Range-diff:$" 0000-* &&
824 - grep "= 1: .* s/5/A" 0000-* &&
825 - grep "= 2: .* s/4/A" 0000-* &&
826 - grep "= 3: .* s/11/B" 0000-* &&
827 - grep "! 4: .* s/12/B" 0000-* &&
824 + test_grep "= 1: .* s/5/A" 0000-* &&
825 + test_grep "= 2: .* s/4/A" 0000-* &&
826 + test_grep "= 3: .* s/11/B" 0000-* &&
827 + test_grep "! 4: .* s/12/B" 0000-* &&
828 sed s/Z/\ /g >expect <<-EOF &&
829 @@ Commit message
830 Z
@@ -866,9 +866,9 @@ test_expect_success 'ranges with pathspecs' '
866 topic_oid=$(git rev-parse --short topic) &&
867 mode_change_oid=$(git rev-parse --short mode-only-change^) &&
868 file_change_oid=$(git rev-parse --short mode-only-change) &&
869 - grep "$mode_change_oid" actual &&
870 - ! grep "$file_change_oid" actual &&
871 - ! grep "$topic_oid" actual
869 + test_grep "$mode_change_oid" actual &&
870 + test_grep ! "$file_change_oid" actual &&
871 + test_grep ! "$topic_oid" actual
872 '
873
874 test_expect_success 'submodule changes are shown irrespective of diff.submodule' '
t/t3207-branch-submodule.sh
+2 -2
@@ -136,7 +136,7 @@ test_expect_success 'should not create any branches if branch is not valid for a
136 git -C sub branch branch-a &&
137 test_must_fail git branch --recurse-submodules branch-a 2>actual &&
138 test_no_branch . branch-a &&
139 - grep "submodule .sub.: fatal: a branch named .branch-a. already exists" actual
139 + test_grep "submodule .sub.: fatal: a branch named .branch-a. already exists" actual
140 )
141 '
142
@@ -251,7 +251,7 @@ test_expect_success 'should get fatal error upon branch creation when submodule
251 git branch --recurse-submodules branch-a origin/branch-a &&
252 # This should fail because super-clone does not have sub2 .git/modules
253 test_must_fail git branch --recurse-submodules branch-b origin/branch-b 2>actual &&
254 - grep "fatal: submodule .sub2.: unable to find submodule" actual &&
254 + test_grep "fatal: submodule .sub2.: unable to find submodule" actual &&
255 test_no_branch . branch-b &&
256 test_no_branch sub branch-b &&
257 # User can fix themselves by initializing the submodule
t/t3301-notes.sh
+16 -16
@@ -164,7 +164,7 @@ test_expect_success 'show notes' '
164 ${indent}b1
165 EOF
166 git cat-file commit HEAD >commits &&
167 - ! grep b1 commits &&
167 + test_grep ! b1 commits &&
168 git log -1 >actual &&
169 test_cmp expect actual
170 '
@@ -248,17 +248,17 @@ test_expect_success 'git log --show-notes' '
248
249 test_expect_success 'git log --no-notes' '
250 git log -1 --no-notes >actual &&
251 - ! grep xyzzy actual
251 + test_grep ! xyzzy actual
252 '
253
254 test_expect_success 'git format-patch does not show notes' '
255 git format-patch -1 --stdout >actual &&
256 - ! grep xyzzy actual
256 + test_grep ! xyzzy actual
257 '
258
259 test_expect_success 'git format-patch --show-notes does show notes' '
260 git format-patch --show-notes -1 --stdout >actual &&
261 - grep xyzzy actual
261 + test_grep xyzzy actual
262 '
263
264 for pretty in \
@@ -281,36 +281,36 @@ test_expect_success 'setup alternate notes ref' '
281
282 test_expect_success 'git log --notes shows default notes' '
283 git log -1 --notes >actual &&
284 - grep xyzzy actual &&
285 - ! grep alternate actual
284 + test_grep xyzzy actual &&
285 + test_grep ! alternate actual
286 '
287
288 test_expect_success 'git log --notes=X shows only X' '
289 git log -1 --notes=alternate >actual &&
290 - ! grep xyzzy actual &&
291 - grep alternate actual
290 + test_grep ! xyzzy actual &&
291 + test_grep alternate actual
292 '
293
294 test_expect_success 'git log --notes --notes=X shows both' '
295 git log -1 --notes --notes=alternate >actual &&
296 - grep xyzzy actual &&
297 - grep alternate actual
296 + test_grep xyzzy actual &&
297 + test_grep alternate actual
298 '
299
300 test_expect_success 'git log --no-notes resets default state' '
301 git log -1 --notes --notes=alternate \
302 --no-notes --notes=alternate \
303 >actual &&
304 - ! grep xyzzy actual &&
305 - grep alternate actual
304 + test_grep ! xyzzy actual &&
305 + test_grep alternate actual
306 '
307
308 test_expect_success 'git log --no-notes resets ref list' '
309 git log -1 --notes --notes=alternate \
310 --no-notes --notes \
311 >actual &&
312 - grep xyzzy actual &&
313 - ! grep alternate actual
312 + test_grep xyzzy actual &&
313 + test_grep ! alternate actual
314 '
315
316 test_expect_success 'show -m notes' '
@@ -543,7 +543,7 @@ test_expect_success 'list notes with "git notes"' '
543
544 test_expect_success '"git notes" without subcommand does not take arguments' '
545 test_expect_code 129 git notes HEAD^^ 2>err &&
546 - grep "^error: unknown subcommand" err
546 + test_grep "^error: unknown subcommand" err
547 '
548
549 test_expect_success 'list specific note with "git notes list <object>"' '
@@ -1464,7 +1464,7 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' '
1464 GIT_NOTES_REWRITE_REF=refs/notes/commits \
1465 git notes copy --for-rewrite=foo <copy &&
1466 git log -1 >actual &&
1467 - grep "replacement note 3" actual
1467 + test_grep "replacement note 3" actual
1468 '
1469
1470 test_expect_success 'git notes copy diagnoses too many or too few arguments' '
t/t3310-notes-merge-manual-resolve.sh
+8 -8
@@ -382,12 +382,12 @@ EOF
382 test_cmp pre_merge_z actual &&
383 # Merge commit mentions the notes refs merged
384 git log -1 --format=%B refs/notes/m > merge_commit_msg &&
385 - grep -q refs/notes/m merge_commit_msg &&
386 - grep -q refs/notes/z merge_commit_msg &&
385 + test_grep -q refs/notes/m merge_commit_msg &&
386 + test_grep -q refs/notes/z merge_commit_msg &&
387 # Merge commit mentions conflicting notes
388 - grep -q "Conflicts" merge_commit_msg &&
388 + test_grep -q "Conflicts" merge_commit_msg &&
389 ( for sha1 in $(cat expect_conflicts); do
390 - grep -q "$sha1" merge_commit_msg ||
390 + test_grep -q "$sha1" merge_commit_msg ||
391 exit 1
392 done ) &&
393 # Verify contents of merge result
@@ -512,12 +512,12 @@ EOF
512 test_cmp pre_merge_z actual &&
513 # Merge commit mentions the notes refs merged
514 git log -1 --format=%B refs/notes/m > merge_commit_msg &&
515 - grep -q refs/notes/m merge_commit_msg &&
516 - grep -q refs/notes/z merge_commit_msg &&
515 + test_grep -q refs/notes/m merge_commit_msg &&
516 + test_grep -q refs/notes/z merge_commit_msg &&
517 # Merge commit mentions conflicting notes
518 - grep -q "Conflicts" merge_commit_msg &&
518 + test_grep -q "Conflicts" merge_commit_msg &&
519 ( for sha1 in $(cat expect_conflicts); do
520 - grep -q "$sha1" merge_commit_msg ||
520 + test_grep -q "$sha1" merge_commit_msg ||
521 exit 1
522 done ) &&
523 # Verify contents of merge result
t/t3320-notes-merge-worktrees.sh
+1 -1
@@ -67,7 +67,7 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' '
67 git config core.notesRef refs/notes/x &&
68 test_must_fail git notes merge z >out 2>&1 &&
69 test_grep "Automatic notes merge failed" out &&
70 - grep -v "A notes merge into refs/notes/x is already in-progress in" out
70 + test_grep -v "A notes merge into refs/notes/x is already in-progress in" out
71 ) &&
72 echo "refs/notes/x" >expect &&
73 git -C worktree2 symbolic-ref NOTES_MERGE_REF >actual &&
t/t3400-rebase.sh
+8 -8
@@ -287,16 +287,16 @@ test_expect_success 'rebase commit with an ancient timestamp' '
287 git commit --date="@34567 +0600" -m "Old three" &&
288
289 git cat-file commit HEAD^^ >actual &&
290 - grep "author .* 12345 +0400$" actual &&
290 + test_grep "author .* 12345 +0400$" actual &&
291 git cat-file commit HEAD^ >actual &&
292 - grep "author .* 23456 +0500$" actual &&
292 + test_grep "author .* 23456 +0500$" actual &&
293 git cat-file commit HEAD >actual &&
294 - grep "author .* 34567 +0600$" actual &&
294 + test_grep "author .* 34567 +0600$" actual &&
295
296 git rebase --onto HEAD^^ HEAD^ &&
297
298 git cat-file commit HEAD >actual &&
299 - grep "author .* 34567 +0600$" actual
299 + test_grep "author .* 34567 +0600$" actual
300 '
301
302 test_expect_success 'rebase with "From " line in commit message' '
@@ -333,7 +333,7 @@ test_expect_success 'rebase --apply and --show-current-patch' '
333 git tag two &&
334 test_must_fail git rebase --apply -f --onto init HEAD^ &&
335 GIT_TRACE=1 git rebase --show-current-patch >/dev/null 2>stderr &&
336 - grep "show.*$(git rev-parse two)" stderr
336 + test_grep "show.*$(git rev-parse two)" stderr
337 )
338 '
339
@@ -364,12 +364,12 @@ test_expect_success 'rebase --apply and .gitattributes' '
364
365 git checkout test &&
366 git rebase main &&
367 - grep "smudged" a.txt &&
367 + test_grep "smudged" a.txt &&
368
369 git checkout removal &&
370 git reset --hard &&
371 git rebase main &&
372 - grep "clean" a.txt
372 + test_grep "clean" a.txt
373 )
374 '
375
@@ -386,7 +386,7 @@ test_expect_success 'rebase--merge.sh and --show-current-patch' '
386 test_must_fail git rebase --merge --onto init HEAD^ &&
387 git rebase --show-current-patch >actual.patch &&
388 GIT_TRACE=1 git rebase --show-current-patch >/dev/null 2>stderr &&
389 - grep "show.*REBASE_HEAD" stderr &&
389 + test_grep "show.*REBASE_HEAD" stderr &&
390 test "$(git rev-parse REBASE_HEAD)" = "$(git rev-parse two)"
391 )
392 '
t/t3402-rebase-merge.sh
+8 -8
@@ -84,8 +84,8 @@ test_expect_success 'rebase -Xtheirs' '
84 echo "AB $T" >> original &&
85 git commit -mconflicting original &&
86 git rebase -Xtheirs main &&
87 - grep AB original &&
88 - ! grep 11 original
87 + test_grep AB original &&
88 + test_grep ! 11 original
89 '
90
91 test_expect_success 'rebase -Xtheirs from orphan' '
@@ -93,8 +93,8 @@ test_expect_success 'rebase -Xtheirs from orphan' '
93 echo "AB $T" >> original &&
94 git commit -morphan-conflicting original &&
95 git rebase -Xtheirs main &&
96 - grep AB original &&
97 - ! grep 11 original
96 + test_grep AB original &&
97 + test_grep ! 11 original
98 '
99
100 test_expect_success 'merge and rebase should match' '
@@ -210,15 +210,15 @@ test_expect_success '--reapply-cherry-picks refrains from reading unneeded blobs
210 git -C client rev-list --objects --all --missing=print >missing_list &&
211 MERGE_BASE_BLOB=$(git -C server rev-parse main^^:file.txt) &&
212 ADD_11_BLOB=$(git -C server rev-parse main^:file.txt) &&
213 - grep "[?]$MERGE_BASE_BLOB" missing_list &&
214 - grep "[?]$ADD_11_BLOB" missing_list &&
213 + test_grep "[?]$MERGE_BASE_BLOB" missing_list &&
214 + test_grep "[?]$ADD_11_BLOB" missing_list &&
215
216 git -C client rebase --merge --reapply-cherry-picks origin/main &&
217
218 # The blob from the merge base had to be fetched, but not "add 11"
219 git -C client rev-list --objects --all --missing=print >missing_list &&
220 - ! grep "[?]$MERGE_BASE_BLOB" missing_list &&
221 - grep "[?]$ADD_11_BLOB" missing_list
220 + test_grep ! "[?]$MERGE_BASE_BLOB" missing_list &&
221 + test_grep "[?]$ADD_11_BLOB" missing_list
222 '
223
224 test_done
t/t3404-rebase-interactive.sh
+36 -36
@@ -144,7 +144,7 @@ test_expect_success 'rebase -i sets work tree properly' '
144 mkdir subdir &&
145 git rebase -x "(cd subdir && git rev-parse --show-toplevel)" HEAD^ \
146 >actual &&
147 - ! grep "/subdir$" actual
147 + test_grep ! "/subdir$" actual
148 '
149
150 test_expect_success 'rebase -i with the exec command checks tree cleanness' '
@@ -196,7 +196,7 @@ test_expect_success 'rebase -i with exec of inexistent command' '
196 test_must_fail env FAKE_LINES="exec_this-command-does-not-exist 1" \
197 git rebase -i HEAD^ >actual 2>&1
198 ) &&
199 - ! grep "Maybe git-rebase is broken" actual
199 + test_grep ! "Maybe git-rebase is broken" actual
200 '
201
202 test_expect_success 'implicit interactive rebase does not invoke sequence editor' '
@@ -293,7 +293,7 @@ test_expect_success 'stop on conflicting pick' '
293
294 test_expect_success 'show conflicted patch' '
295 GIT_TRACE=1 git rebase --show-current-patch >/dev/null 2>stderr &&
296 - grep "show.*REBASE_HEAD" stderr &&
296 + test_grep "show.*REBASE_HEAD" stderr &&
297 # the original stopped-sha1 is abbreviated
298 stopped_sha1="$(git rev-parse $(cat ".git/rebase-merge/stopped-sha"))" &&
299 test "$(git rev-parse REBASE_HEAD)" = "$stopped_sha1"
@@ -326,7 +326,7 @@ test_expect_success 'retain authorship' '
326 git tag twerp &&
327 git rebase -i --onto primary HEAD^ &&
328 git show HEAD >actual &&
329 - grep "^Author: Twerp Snog" actual
329 + test_grep "^Author: Twerp Snog" actual
330 '
331
332 test_expect_success 'retain authorship w/ conflicts' '
@@ -348,7 +348,7 @@ test_expect_success 'retain authorship w/ conflicts' '
348 git rebase --continue &&
349 test_cmp_rev conflict-a^0 HEAD^ &&
350 git show >out &&
351 - grep AttributeMe out
351 + test_grep AttributeMe out
352 '
353
354 test_expect_success 'squash' '
@@ -368,7 +368,7 @@ test_expect_success 'squash' '
368
369 test_expect_success 'retain authorship when squashing' '
370 git show HEAD >actual &&
371 - grep "^Author: Twerp Snog" actual
371 + test_grep "^Author: Twerp Snog" actual
372 '
373
374 test_expect_success '--continue tries to commit' '
@@ -383,7 +383,7 @@ test_expect_success '--continue tries to commit' '
383 ) &&
384 test_cmp_rev HEAD^ new-branch1 &&
385 git show HEAD >actual &&
386 - grep chouette actual
386 + test_grep chouette actual
387 '
388
389 test_expect_success 'verbose flag is heeded, even after --continue' '
@@ -393,7 +393,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '
393 echo resolved > file1 &&
394 git add file1 &&
395 git rebase --continue > output &&
396 - grep "^ file1 | 2 +-$" output
396 + test_grep "^ file1 | 2 +-$" output
397 '
398
399 test_expect_success 'multi-squash only fires up editor once' '
@@ -422,7 +422,7 @@ test_expect_success 'multi-fixup does not fire up editor' '
422 ) &&
423 test $base = $(git rev-parse HEAD^) &&
424 git show >output &&
425 - ! grep NEVER output &&
425 + test_grep ! NEVER output &&
426 git checkout @{-1} &&
427 git branch -D multi-fixup
428 '
@@ -487,9 +487,9 @@ test_expect_success 'squash and fixup generate correct log messages' '
487 git cat-file commit HEAD | sed -e 1,/^\$/d > actual-squash-fixup &&
488 test_cmp expect-squash-fixup actual-squash-fixup &&
489 git cat-file commit HEAD@{2} >actual &&
490 - grep "^# This is a combination of 3 commits\." actual &&
490 + test_grep "^# This is a combination of 3 commits\." actual &&
491 git cat-file commit HEAD@{3} >actual &&
492 - grep "^# This is a combination of 2 commits\." actual &&
492 + test_grep "^# This is a combination of 2 commits\." actual &&
493 git checkout @{-1} &&
494 git branch -D squash-fixup
495 '
@@ -593,7 +593,7 @@ test_expect_success '--continue tries to commit, even for "edit"' '
593 ) &&
594 test edited = $(git show HEAD:file7) &&
595 git show HEAD >actual &&
596 - grep chouette actual &&
596 + test_grep chouette actual &&
597 test $parent = $(git rev-parse HEAD^)
598 '
599
@@ -779,22 +779,22 @@ test_expect_success 'reword' '
779 FAKE_LINES="1 2 3 reword 4" FAKE_COMMIT_MESSAGE="E changed" \
780 git rebase -i A &&
781 git show HEAD >actual &&
782 - grep "E changed" actual &&
782 + test_grep "E changed" actual &&
783 test $(git rev-parse primary) != $(git rev-parse HEAD) &&
784 test_cmp_rev primary^ HEAD^ &&
785 FAKE_LINES="1 2 reword 3 4" FAKE_COMMIT_MESSAGE="D changed" \
786 git rebase -i A &&
787 git show HEAD^ >actual &&
788 - grep "D changed" actual &&
788 + test_grep "D changed" actual &&
789 FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" \
790 git rebase -i A &&
791 git show HEAD~3 >actual &&
792 - grep "B changed" actual &&
792 + test_grep "B changed" actual &&
793 FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" \
794 git rebase -i A
795 ) &&
796 git show HEAD~2 >actual &&
797 - grep "C changed" actual
797 + test_grep "C changed" actual
798 '
799
800 test_expect_success 'reword fast-forwarded empty commit' '
@@ -1043,9 +1043,9 @@ test_expect_success 'rebase -i --root retain root commit author and message' '
1043 FAKE_LINES="2" git rebase -i --root
1044 ) &&
1045 git cat-file commit HEAD >output &&
1046 - grep -q "^author Twerp Snog" output &&
1046 + test_grep -q "^author Twerp Snog" output &&
1047 git cat-file commit HEAD >actual &&
1048 - grep -q "^different author$" actual
1048 + test_grep -q "^different author$" actual
1049 '
1050
1051 test_expect_success 'rebase -i --root temporary sentinel commit' '
@@ -1055,7 +1055,7 @@ test_expect_success 'rebase -i --root temporary sentinel commit' '
1055 test_must_fail env FAKE_LINES="2" git rebase -i --root
1056 ) &&
1057 git cat-file commit HEAD >actual &&
1058 - grep "^tree $EMPTY_TREE" actual &&
1058 + test_grep "^tree $EMPTY_TREE" actual &&
1059 git rebase --abort
1060 '
1061
@@ -1079,7 +1079,7 @@ test_expect_success 'rebase -i --root reword original root commit' '
1079 git rebase -i --root
1080 ) &&
1081 git show HEAD^ >actual &&
1082 - grep "A changed" actual &&
1082 + test_grep "A changed" actual &&
1083 test -z "$(git show -s --format=%p HEAD^)"
1084 '
1085
@@ -1092,7 +1092,7 @@ test_expect_success 'rebase -i --root reword new root commit' '
1092 git rebase -i --root
1093 ) &&
1094 git show HEAD^ >actual &&
1095 - grep "C changed" actual &&
1095 + test_grep "C changed" actual &&
1096 test -z "$(git show -s --format=%p HEAD^)"
1097 '
1098
@@ -1315,11 +1315,11 @@ test_expect_success 'short commit ID collide' '
1315 FAKE_COMMIT_MESSAGE="collide2 $(test_oid t3404_collider)" \
1316 FAKE_LINES="reword 1 break 2" git rebase -i HEAD~2 &&
1317 test $colliding_id = "$(git rev-parse HEAD | cut -c 1-4)" &&
1318 - grep "^pick $colliding_id " \
1318 + test_grep "^pick $colliding_id " \
1319 .git/rebase-merge/git-rebase-todo.tmp &&
1320 - grep -E "^pick [0-9a-f]{$hexsz}" \
1320 + test_grep -E "^pick [0-9a-f]{$hexsz}" \
1321 .git/rebase-merge/git-rebase-todo &&
1322 - grep -E "^pick [0-9a-f]{$hexsz}" \
1322 + test_grep -E "^pick [0-9a-f]{$hexsz}" \
1323 .git/rebase-merge/git-rebase-todo.backup &&
1324 git rebase --continue
1325 ) &&
@@ -1371,7 +1371,7 @@ test_expect_success 'rebase -i commits that overwrite untracked files (pick)' '
1371 echo changed >file1 &&
1372 git add file1 &&
1373 test_must_fail git rebase --continue 2>err &&
1374 - grep "error: you have staged changes in your working tree" err &&
1374 + test_grep "error: you have staged changes in your working tree" err &&
1375 git reset --hard HEAD &&
1376 git rebase --continue &&
1377 test_cmp_rev HEAD D &&
@@ -1398,7 +1398,7 @@ test_expect_success 'rebase -i commits that overwrite untracked files (squash)'
1398 echo changed >file1 &&
1399 git add file1 &&
1400 test_must_fail git rebase --continue 2>err &&
1401 - grep "error: you have staged changes in your working tree" err &&
1401 + test_grep "error: you have staged changes in your working tree" err &&
1402 git reset --hard HEAD &&
1403 git rebase --continue &&
1404 test $(git cat-file commit HEAD | sed -ne \$p) = I &&
@@ -1423,7 +1423,7 @@ test_expect_success 'rebase -i commits that overwrite untracked files (no ff)' '
1423 echo changed >file1 &&
1424 git add file1 &&
1425 test_must_fail git rebase --continue 2>err &&
1426 - grep "error: you have staged changes in your working tree" err &&
1426 + test_grep "error: you have staged changes in your working tree" err &&
1427 git reset --hard HEAD &&
1428 git rebase --continue &&
1429 test $(git cat-file commit HEAD | sed -ne \$p) = I
@@ -1709,15 +1709,15 @@ test_expect_success 'the first command cannot be a fixup' '
1709 set_replace_editor orig &&
1710 test_must_fail git rebase -i A 2>actual
1711 ) &&
1712 - grep "cannot .fixup. without a previous commit" actual &&
1713 - grep "You can fix this with .git rebase --edit-todo.." actual &&
1712 + test_grep "cannot .fixup. without a previous commit" actual &&
1713 + test_grep "You can fix this with .git rebase --edit-todo.." actual &&
1714 # verify that the todo list has not been truncated
1715 grep -v "^#" .git/rebase-merge/git-rebase-todo >actual &&
1716 test_cmp orig actual &&
1717
1718 test_must_fail git rebase --edit-todo 2>actual &&
1719 - grep "cannot .fixup. without a previous commit" actual &&
1720 - grep "You can fix this with .git rebase --edit-todo.." actual &&
1719 + test_grep "cannot .fixup. without a previous commit" actual &&
1720 + test_grep "You can fix this with .git rebase --edit-todo.." actual &&
1721 # verify that the todo list has not been truncated
1722 grep -v "^#" .git/rebase-merge/git-rebase-todo >actual &&
1723 test_cmp orig actual
@@ -2252,7 +2252,7 @@ test_expect_success '--update-refs: check failed ref update' '
2252 git update-ref refs/heads/second third &&
2253
2254 test_must_fail git rebase --continue 2>err &&
2255 - grep "update_ref failed for ref '\''refs/heads/second'\''" err &&
2255 + test_grep "update_ref failed for ref '\''refs/heads/second'\''" err &&
2256
2257 q_to_tab >expect <<-\EOF &&
2258 Updated the following refs with --update-refs:
@@ -2283,10 +2283,10 @@ test_expect_success 'bad labels and refs rejected when parsing todo list' '
2283 set_replace_editor todo &&
2284 test_must_fail git rebase -i HEAD 2>err
2285 ) &&
2286 - grep "'\''#'\'' is not a valid label" err &&
2287 - grep "'\'':invalid'\'' is not a valid label" err &&
2288 - grep "'\'':bad'\'' is not a valid refname" err &&
2289 - grep "update-ref requires a fully qualified refname e.g. refs/heads/topic" \
2286 + test_grep "'\''#'\'' is not a valid label" err &&
2287 + test_grep "'\'':invalid'\'' is not a valid label" err &&
2288 + test_grep "'\'':bad'\'' is not a valid refname" err &&
2289 + test_grep "update-ref requires a fully qualified refname e.g. refs/heads/topic" \
2290 err &&
2291 test_path_is_missing execed
2292 '
t/t3406-rebase-message.sh
+3 -3
@@ -62,21 +62,21 @@ test_expect_success 'rebase fast-forward to main' '
62 test_expect_success 'rebase --stat' '
63 git reset --hard start &&
64 git rebase --stat main >diffstat.txt &&
65 - grep "^ fileX | *1 +$" diffstat.txt
65 + test_grep "^ fileX | *1 +$" diffstat.txt
66 '
67
68 test_expect_success 'rebase w/config rebase.stat' '
69 git reset --hard start &&
70 git config rebase.stat true &&
71 git rebase main >diffstat.txt &&
72 - grep "^ fileX | *1 +$" diffstat.txt
72 + test_grep "^ fileX | *1 +$" diffstat.txt
73 '
74
75 test_expect_success 'rebase -n overrides config rebase.stat config' '
76 git reset --hard start &&
77 git config rebase.stat true &&
78 git rebase -n main >diffstat.txt &&
79 - ! grep "^ fileX | *1 +$" diffstat.txt
79 + test_grep ! "^ fileX | *1 +$" diffstat.txt
80 '
81
82 test_expect_success 'rebase --onto outputs the invalid ref' '
t/t3415-rebase-autosquash.sh
+5 -5
@@ -223,7 +223,7 @@ test_expect_success 'auto squash that matches a sha1' '
223 git cat-file blob HEAD^:file1 >actual &&
224 test_cmp expect actual &&
225 git cat-file commit HEAD^ >commit &&
226 - ! grep "squash" commit &&
226 + test_grep ! "squash" commit &&
227 grep "^extra para" commit >actual &&
228 test_line_count = 1 actual
229 '
@@ -245,7 +245,7 @@ test_expect_success 'auto squash that matches longer sha1' '
245 git cat-file blob HEAD^:file1 >actual &&
246 test_cmp expect actual &&
247 git cat-file commit HEAD^ >commit &&
248 - ! grep "squash" commit &&
248 + test_grep ! "squash" commit &&
249 grep "^extra para" commit >actual &&
250 test_line_count = 1 actual
251 '
@@ -377,7 +377,7 @@ test_expect_success 'autosquash with custom inst format' '
377 git cat-file blob HEAD^:file1 >actual &&
378 test_cmp expect actual &&
379 git cat-file commit HEAD^ >commit &&
380 - ! grep "squash" commit &&
380 + test_grep ! "squash" commit &&
381 grep first commit >actual &&
382 test_line_count = 3 actual
383 '
@@ -424,7 +424,7 @@ test_expect_success 'autosquash with multiple empty patches' '
424 set_backup_editor &&
425 GIT_USE_REBASE_HELPER=false \
426 git rebase -i --force-rebase --autosquash HEAD~4 &&
427 - grep empty2 .git/backup-git-rebase-todo
427 + test_grep empty2 .git/backup-git-rebase-todo
428 )
429 '
430
@@ -467,7 +467,7 @@ test_expect_success 'abort last squash' '
467 git commit --allow-empty --amend -m edited-first &&
468 git rebase --skip &&
469 git show >actual &&
470 - ! grep first actual
470 + test_grep ! first actual
471 '
472
473 test_expect_success 'fixup a fixup' '
t/t3416-rebase-onto-threedots.sh
+2 -2
@@ -107,7 +107,7 @@ test_expect_success 'rebase --onto main...side requires a single merge-base' '
107 git reset --hard K &&
108
109 test_must_fail git rebase -i --onto main...side J 2>err &&
110 - grep "need exactly one merge base" err
110 + test_grep "need exactly one merge base" err
111 '
112
113 test_expect_success 'rebase --keep-base --onto incompatible' '
@@ -196,7 +196,7 @@ test_expect_success 'rebase --keep-base requires a single merge base' '
196 git reset --hard K &&
197
198 test_must_fail git rebase -i --keep-base main 2>err &&
199 - grep "need exactly one merge base with branch" err
199 + test_grep "need exactly one merge base with branch" err
200 '
201
202 test_expect_success 'rebase --keep-base keeps cherry picks' '
t/t3418-rebase-continue.sh
+5 -5
@@ -289,18 +289,18 @@ test_expect_success 'patch file is removed before break command' '
289 test_expect_success '--reschedule-failed-exec' '
290 test_when_finished "git rebase --abort" &&
291 test_must_fail git rebase -x false --reschedule-failed-exec HEAD^ &&
292 - grep "^exec false" .git/rebase-merge/git-rebase-todo &&
292 + test_grep "^exec false" .git/rebase-merge/git-rebase-todo &&
293 git rebase --abort &&
294 test_must_fail git -c rebase.rescheduleFailedExec=true \
295 rebase -x false HEAD^ 2>err &&
296 - grep "^exec false" .git/rebase-merge/git-rebase-todo &&
296 + test_grep "^exec false" .git/rebase-merge/git-rebase-todo &&
297 test_grep "has been rescheduled" err
298 '
299
300 test_expect_success 'rebase.rescheduleFailedExec only affects `rebase -i`' '
301 test_config rebase.rescheduleFailedExec true &&
302 test_must_fail git rebase -x false HEAD^ &&
303 - grep "^exec false" .git/rebase-merge/git-rebase-todo &&
303 + test_grep "^exec false" .git/rebase-merge/git-rebase-todo &&
304 git rebase --abort &&
305 git rebase HEAD^
306 '
@@ -310,7 +310,7 @@ test_expect_success 'rebase.rescheduleFailedExec=true & --no-reschedule-failed-e
310 test_config rebase.rescheduleFailedExec true &&
311 test_must_fail git rebase -x false --no-reschedule-failed-exec HEAD~2 &&
312 test_must_fail git rebase --continue 2>err &&
313 - ! grep "has been rescheduled" err
313 + test_grep ! "has been rescheduled" err
314 '
315
316 test_expect_success 'new rebase.rescheduleFailedExec=true setting in an ongoing rebase is ignored' '
@@ -318,7 +318,7 @@ test_expect_success 'new rebase.rescheduleFailedExec=true setting in an ongoing
318 test_must_fail git rebase -x false HEAD~2 &&
319 test_config rebase.rescheduleFailedExec true &&
320 test_must_fail git rebase --continue 2>err &&
321 - ! grep "has been rescheduled" err
321 + test_grep ! "has been rescheduled" err
322 '
323
324 test_expect_success 'there is no --no-reschedule-failed-exec in an ongoing rebase' '
t/t3420-rebase-autostash.sh
+12 -12
@@ -141,8 +141,8 @@ testrebase () {
141 git checkout -b rebased-feature-branch feature-branch &&
142 echo dirty >>file3 &&
143 git rebase$type unrelated-onto-branch >actual 2>&1 &&
144 - grep unrelated file4 &&
145 - grep dirty file3 &&
144 + test_grep unrelated file4 &&
145 + test_grep dirty file3 &&
146 git checkout feature-branch
147 '
148
@@ -165,8 +165,8 @@ testrebase () {
165 echo dirty >>file3 &&
166 git add file3 &&
167 git rebase$type unrelated-onto-branch &&
168 - grep unrelated file4 &&
169 - grep dirty file3 &&
168 + test_grep unrelated file4 &&
169 + test_grep dirty file3 &&
170 git checkout feature-branch
171 '
172
@@ -197,7 +197,7 @@ testrebase () {
197 git add file2 &&
198 git rebase --continue &&
199 test_path_is_missing $dotest/autostash &&
200 - grep dirty file3 &&
200 + test_grep dirty file3 &&
201 git checkout feature-branch
202 '
203
@@ -212,7 +212,7 @@ testrebase () {
212 test_path_is_missing file3 &&
213 git rebase --skip &&
214 test_path_is_missing $dotest/autostash &&
215 - grep dirty file3 &&
215 + test_grep dirty file3 &&
216 git checkout feature-branch
217 '
218
@@ -227,7 +227,7 @@ testrebase () {
227 test_path_is_missing file3 &&
228 git rebase --abort &&
229 test_path_is_missing $dotest/autostash &&
230 - grep dirty file3 &&
230 + test_grep dirty file3 &&
231 git checkout feature-branch
232 '
233
@@ -260,11 +260,11 @@ testrebase () {
260 git rebase$type unrelated-onto-branch >actual 2>&1 &&
261 test_path_is_missing $dotest &&
262 git reset --hard &&
263 - grep unrelated file4 &&
264 - ! grep dirty file4 &&
263 + test_grep unrelated file4 &&
264 + test_grep ! dirty file4 &&
265 git checkout feature-branch &&
266 git stash pop &&
267 - grep dirty file4
267 + test_grep dirty file4
268 '
269
270 test_expect_success "rebase$type: check output with conflicting stash" '
@@ -286,7 +286,7 @@ test_expect_success "rebase: fast-forward rebase" '
286 test_when_finished git branch -D behind-feature-branch &&
287 echo dirty >>file1 &&
288 git rebase feature-branch &&
289 - grep dirty file1 &&
289 + test_grep dirty file1 &&
290 git checkout feature-branch
291 '
292
@@ -297,7 +297,7 @@ test_expect_success "rebase: noop rebase" '
297 test_when_finished git branch -D same-feature-branch &&
298 echo dirty >>file1 &&
299 git rebase feature-branch &&
300 - grep dirty file1 &&
300 + test_grep dirty file1 &&
301 git checkout feature-branch
302 '
303
t/t3422-rebase-incompatible-options.sh
+2 -2
@@ -102,13 +102,13 @@ test_rebase_am_only () {
102 test_expect_success "$opt incompatible with rebase.rebaseMerges" "
103 git checkout B^0 &&
104 test_must_fail git -c rebase.rebaseMerges=true rebase $opt A 2>err &&
105 - grep -e --no-rebase-merges err
105 + test_grep -e --no-rebase-merges err
106 "
107
108 test_expect_success "$opt incompatible with rebase.updateRefs" "
109 git checkout B^0 &&
110 test_must_fail git -c rebase.updateRefs=true rebase $opt A 2>err &&
111 - grep -e --no-update-refs err
111 + test_grep -e --no-update-refs err
112 "
113
114 test_expect_success "$opt okay with overridden rebase.rebaseMerges" "
t/t3429-rebase-edit-todo.sh
+1 -1
@@ -19,7 +19,7 @@ test_expect_success 'rebase exec modifies rebase-todo' '
19
20 test_expect_success 'rebase exec with an empty list does not exec anything' '
21 git rebase HEAD -x "true" 2>output &&
22 - ! grep "Executing: true" output
22 + test_grep ! "Executing: true" output
23 '
24
25 test_expect_success 'loose object cache vs re-reading todo list' '
t/t3430-rebase-merges.sh
+16 -16
@@ -161,7 +161,7 @@ test_expect_success '`reset` rejects trees' '
161 test_when_finished "test_might_fail git rebase --abort" &&
162 test_must_fail env GIT_SEQUENCE_EDITOR="echo reset A^{tree} >" \
163 git rebase -i B C >out 2>err &&
164 - grep "object .* is a tree" err &&
164 + test_grep "object .* is a tree" err &&
165 test_must_be_empty out
166 '
167
@@ -170,7 +170,7 @@ test_expect_success '`reset` only looks for labels under refs/rewritten/' '
170 git branch refs/rewritten/my-label A &&
171 test_must_fail env GIT_SEQUENCE_EDITOR="echo reset my-label >" \
172 git rebase -i B C >out 2>err &&
173 - grep "could not resolve ${SQ}my-label${SQ}" err &&
173 + test_grep "could not resolve ${SQ}my-label${SQ}" err &&
174 test_must_be_empty out
175 '
176
@@ -185,18 +185,18 @@ test_expect_success 'failed `merge -C` writes patch (may be rescheduled, too)' '
185 test_tick &&
186 test_must_fail git rebase -ir HEAD &&
187 test_cmp_rev REBASE_HEAD H^0 &&
188 - grep "^merge -C .* G$" .git/rebase-merge/done &&
189 - grep "^merge -C .* G$" .git/rebase-merge/git-rebase-todo &&
188 + test_grep "^merge -C .* G$" .git/rebase-merge/done &&
189 + test_grep "^merge -C .* G$" .git/rebase-merge/git-rebase-todo &&
190 test_path_is_missing .git/rebase-merge/patch &&
191 echo changed >file1 &&
192 git add file1 &&
193 test_must_fail git rebase --continue 2>err &&
194 - grep "error: you have staged changes in your working tree" err &&
194 + test_grep "error: you have staged changes in your working tree" err &&
195
196 : fail because of merge conflict &&
197 git reset --hard conflicting-G &&
198 test_must_fail git rebase --continue &&
199 - ! grep "^merge -C .* G$" .git/rebase-merge/git-rebase-todo &&
199 + test_grep ! "^merge -C .* G$" .git/rebase-merge/git-rebase-todo &&
200 test_path_is_file .git/rebase-merge/patch
201 '
202
@@ -208,8 +208,8 @@ test_expect_success 'failed `merge <branch>` does not crash' '
208 test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
209 test_tick &&
210 test_must_fail git rebase -ir HEAD &&
211 - ! grep "^merge G$" .git/rebase-merge/git-rebase-todo &&
212 - grep "^Merge branch ${SQ}G${SQ}$" .git/rebase-merge/message
211 + test_grep ! "^merge G$" .git/rebase-merge/git-rebase-todo &&
212 + test_grep "^Merge branch ${SQ}G${SQ}$" .git/rebase-merge/message
213 '
214
215 test_expect_success 'merge -c commits before rewording and reloads todo-list' '
@@ -481,8 +481,8 @@ test_expect_success 'labels that are object IDs are rewritten' '
481 test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
482 test_tick &&
483 git rebase -i -r A &&
484 - grep "^label $third-" .git/ORIGINAL-TODO &&
485 - ! grep "^label $third$" .git/ORIGINAL-TODO
484 + test_grep "^label $third-" .git/ORIGINAL-TODO &&
485 + test_grep ! "^label $third$" .git/ORIGINAL-TODO
486 '
487
488 test_expect_success 'octopus merges' '
@@ -533,9 +533,9 @@ test_expect_success 'with --autosquash and --exec' '
533 EOF
534 test_tick &&
535 git rebase -ir --autosquash --exec ./show.sh A >actual &&
536 - grep "B: +Booh" actual &&
537 - grep "E: +Booh" actual &&
538 - grep "G: +G" actual
536 + test_grep "B: +Booh" actual &&
537 + test_grep "E: +Booh" actual &&
538 + test_grep "G: +G" actual
539 '
540
541 test_expect_success '--continue after resolving conflicts after a merge' '
@@ -546,7 +546,7 @@ test_expect_success '--continue after resolving conflicts after a merge' '
546 git checkout -b conflicts-in-merge H &&
547 test_commit H2 H2.t conflicts H2-conflict &&
548 test_must_fail git rebase -r already-has-g &&
549 - grep conflicts H2.t &&
549 + test_grep conflicts H2.t &&
550 echo resolved >H2.t &&
551 git add -u &&
552 git rebase --continue &&
@@ -616,9 +616,9 @@ test_expect_success 'truncate label names' '
616
617 done="$(git rev-parse --git-path rebase-merge/done)" &&
618 git -c rebase.maxLabelLength=14 rebase --rebase-merges -x "cp \"$done\" out" --root &&
619 - grep "label 0123456789-我$" out &&
619 + test_grep "label 0123456789-我$" out &&
620 git -c rebase.maxLabelLength=13 rebase --rebase-merges -x "cp \"$done\" out" --root &&
621 - grep "label 0123456789-$" out
621 + test_grep "label 0123456789-$" out
622 '
623
624 test_expect_success 'reword fast-forwarded empty merge commit' '
t/t3500-cherry.sh
+2 -2
@@ -100,8 +100,8 @@ test_expect_success 'cherry in partial clone does bulk prefetch' '
100 GIT_TRACE2_EVENT="$(pwd)/trace2.output" git cherry upstream-with-space feature-without-space >actual &&
101 test_cmp ../expect actual &&
102
103 - ! grep "child_start.*fetch.negotiationAlgorithm" trace2.output &&
104 - ! grep "\"key\":\"fetch_count\"" trace2.output
103 + test_grep ! "child_start.*fetch.negotiationAlgorithm" trace2.output &&
104 + test_grep ! "\"key\":\"fetch_count\"" trace2.output
105 )
106 '
107
t/t3501-revert-cherry-pick.sh
+3 -3
@@ -67,7 +67,7 @@ test_expect_success 'cherry-pick after renaming branch' '
67 git checkout rename2 &&
68 git cherry-pick added &&
69 test_cmp_rev rename2 HEAD^ &&
70 - grep "Add extra line at the end" opos &&
70 + test_grep "Add extra line at the end" opos &&
71 git reflog -1 | grep cherry-pick
72
73 '
@@ -162,7 +162,7 @@ test_expect_success 'cherry-pick works with dirty renamed file' '
162 echo modified >renamed &&
163 git cherry-pick refs/heads/unrelated &&
164 test $(git rev-parse :0:renamed) = $(git rev-parse HEAD~2:to-rename.t) &&
165 - grep -q "^modified$" renamed
165 + test_grep -q "^modified$" renamed
166 '
167
168 test_expect_success 'advice from failed revert' '
@@ -253,7 +253,7 @@ test_expect_success 'identification of reverted commit (revert.reference)' '
253 test_expect_success 'cherry-pick is unaware of --reference (for now)' '
254 test_when_finished "git reset --hard" &&
255 test_must_fail git cherry-pick --reference HEAD 2>actual &&
256 - grep "^usage: git cherry-pick" actual
256 + test_grep "^usage: git cherry-pick" actual
257 '
258
259 test_done
t/t3504-cherry-pick-rerere.sh
+3 -3
@@ -98,9 +98,9 @@ test_expect_success 'cherry-pick --rerere-autoupdate more than once' '
98 test_expect_success 'cherry-pick conflict without rerere' '
99 test_config rerere.enabled false &&
100 test_must_fail git cherry-pick foo-main &&
101 - grep ===== foo &&
102 - grep foo-dev foo &&
103 - grep foo-main foo
101 + test_grep ===== foo &&
102 + test_grep foo-dev foo &&
103 + test_grep foo-main foo
104 '
105
106 test_done
t/t3510-cherry-pick-sequence.sh
+12 -12
@@ -580,10 +580,10 @@ test_expect_success '--continue respects opts' '
580 git cat-file commit HEAD~1 >picked_msg &&
581 git cat-file commit HEAD~2 >unrelatedpick_msg &&
582 git cat-file commit HEAD~3 >initial_msg &&
583 - ! grep "cherry picked from" initial_msg &&
584 - grep "cherry picked from" unrelatedpick_msg &&
585 - grep "cherry picked from" picked_msg &&
586 - grep "cherry picked from" anotherpick_msg
583 + test_grep ! "cherry picked from" initial_msg &&
584 + test_grep "cherry picked from" unrelatedpick_msg &&
585 + test_grep "cherry picked from" picked_msg &&
586 + test_grep "cherry picked from" anotherpick_msg
587 '
588
589 test_expect_success '--continue of single-pick respects -x' '
@@ -594,7 +594,7 @@ test_expect_success '--continue of single-pick respects -x' '
594 git cherry-pick --continue &&
595 test_path_is_missing .git/sequencer &&
596 git cat-file commit HEAD >msg &&
597 - grep "cherry picked from" msg
597 + test_grep "cherry picked from" msg
598 '
599
600 test_expect_success '--continue respects -x in first commit in multi-pick' '
@@ -606,7 +606,7 @@ test_expect_success '--continue respects -x in first commit in multi-pick' '
606 test_path_is_missing .git/sequencer &&
607 git cat-file commit HEAD^ >msg &&
608 picked=$(git rev-parse --verify picked) &&
609 - grep "cherry picked from.*$picked" msg
609 + test_grep "cherry picked from.*$picked" msg
610 '
611
612 test_expect_failure '--signoff is automatically propagated to resolved conflict' '
@@ -621,10 +621,10 @@ test_expect_failure '--signoff is automatically propagated to resolved conflict'
621 git cat-file commit HEAD~1 >picked_msg &&
622 git cat-file commit HEAD~2 >unrelatedpick_msg &&
623 git cat-file commit HEAD~3 >initial_msg &&
624 - ! grep "Signed-off-by:" initial_msg &&
625 - grep "Signed-off-by:" unrelatedpick_msg &&
626 - ! grep "Signed-off-by:" picked_msg &&
627 - grep "Signed-off-by:" anotherpick_msg
624 + test_grep ! "Signed-off-by:" initial_msg &&
625 + test_grep "Signed-off-by:" unrelatedpick_msg &&
626 + test_grep ! "Signed-off-by:" picked_msg &&
627 + test_grep "Signed-off-by:" anotherpick_msg
628 '
629
630 test_expect_failure '--signoff dropped for implicit commit of resolution, multi-pick case' '
@@ -637,7 +637,7 @@ test_expect_failure '--signoff dropped for implicit commit of resolution, multi-
637 git diff --exit-code HEAD &&
638 test_cmp_rev initial HEAD^^ &&
639 git cat-file commit HEAD^ >msg &&
640 - ! grep Signed-off-by: msg
640 + test_grep ! Signed-off-by: msg
641 '
642
643 test_expect_failure 'sign-off needs to be reaffirmed after conflict resolution, single-pick case' '
@@ -650,7 +650,7 @@ test_expect_failure 'sign-off needs to be reaffirmed after conflict resolution,
650 git diff --exit-code HEAD &&
651 test_cmp_rev initial HEAD^ &&
652 git cat-file commit HEAD >msg &&
653 - ! grep Signed-off-by: msg
653 + test_grep ! Signed-off-by: msg
654 '
655
656 test_expect_success 'malformed instruction sheet 1' '
t/t3602-rm-sparse-checkout.sh
+2 -2
@@ -79,8 +79,8 @@ test_expect_success 'do not advice about sparse entries when they do not match t
79 git reset --hard &&
80 git sparse-checkout set a &&
81 test_must_fail git rm nonexistent 2>stderr &&
82 - grep "fatal: pathspec .nonexistent. did not match any files" stderr &&
83 - ! grep -F -f sparse_error_header stderr
82 + test_grep "fatal: pathspec .nonexistent. did not match any files" stderr &&
83 + test_grep ! -F -f sparse_error_header stderr
84 '
85
86 test_expect_success 'do not warn about sparse entries when pathspec matches dense entries' '
t/t3705-add-sparse-checkout.sh
+5 -5
@@ -149,8 +149,8 @@ test_expect_success 'git add --dry-run --ignore-missing warn on sparse path' '
149 test_expect_success 'do not advice about sparse entries when they do not match the pathspec' '
150 setup_sparse_entry &&
151 test_must_fail git add nonexistent 2>stderr &&
152 - grep "fatal: pathspec .nonexistent. did not match any files" stderr &&
153 - ! grep -F -f sparse_error_header stderr
152 + test_grep "fatal: pathspec .nonexistent. did not match any files" stderr &&
153 + test_grep ! -F -f sparse_error_header stderr
154 '
155
156 test_expect_success 'do not warn when pathspec matches dense entries' '
@@ -184,19 +184,19 @@ test_expect_success 'git add fails outside of sparse-checkout definition' '
184 git -c core.autocrlf=input add --sparse sparse_entry 2>stderr &&
185 test_must_be_empty stderr &&
186 git ls-files --stage >actual &&
187 - grep "^100644 .*sparse_entry\$" actual &&
187 + test_grep "^100644 .*sparse_entry\$" actual &&
188
189 git add --sparse --chmod=+x sparse_entry 2>stderr &&
190 test_must_be_empty stderr &&
191 git ls-files --stage >actual &&
192 - grep "^100755 .*sparse_entry\$" actual &&
192 + test_grep "^100755 .*sparse_entry\$" actual &&
193
194 git reset &&
195
196 # This will print a message over stderr on Windows.
197 git add --sparse --renormalize sparse_entry &&
198 git status --porcelain >actual &&
199 - grep "^M sparse_entry\$" actual
199 + test_grep "^M sparse_entry\$" actual
200 '
201
202 test_expect_success 'add obeys advice.updateSparsePath' '
t/t3800-mktag.sh
+2 -2
@@ -535,9 +535,9 @@ test_expect_success 'invalid header entry config & fsck' '
535
536 git fsck &&
537 git -c fsck.extraHeaderEntry=warn fsck 2>err &&
538 - grep "warning .*extraHeaderEntry:" err &&
538 + test_grep "warning .*extraHeaderEntry:" err &&
539 test_must_fail git -c fsck.extraHeaderEntry=error 2>err fsck &&
540 - grep "error .* extraHeaderEntry:" err
540 + test_grep "error .* extraHeaderEntry:" err
541 '
542
543 cat >tag.sig <<EOF
t/t3901-i18n-patch.sh
+8 -8
@@ -81,10 +81,10 @@ test_expect_success 'format-patch output (ISO-8859-1)' '
81
82 git format-patch --stdout main..HEAD^ >out-l1 &&
83 git format-patch --stdout HEAD^ >out-l2 &&
84 - grep "^Content-Type: text/plain; charset=ISO8859-1" out-l1 &&
85 - grep "^From: =?ISO8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l1 &&
86 - grep "^Content-Type: text/plain; charset=ISO8859-1" out-l2 &&
87 - grep "^From: =?ISO8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l2
84 + test_grep "^Content-Type: text/plain; charset=ISO8859-1" out-l1 &&
85 + test_grep "^From: =?ISO8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l1 &&
86 + test_grep "^Content-Type: text/plain; charset=ISO8859-1" out-l2 &&
87 + test_grep "^From: =?ISO8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l2
88 '
89
90 test_expect_success 'format-patch output (UTF-8)' '
@@ -92,10 +92,10 @@ test_expect_success 'format-patch output (UTF-8)' '
92
93 git format-patch --stdout main..HEAD^ >out-u1 &&
94 git format-patch --stdout HEAD^ >out-u2 &&
95 - grep "^Content-Type: text/plain; charset=UTF-8" out-u1 &&
96 - grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u1 &&
97 - grep "^Content-Type: text/plain; charset=UTF-8" out-u2 &&
98 - grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u2
95 + test_grep "^Content-Type: text/plain; charset=UTF-8" out-u1 &&
96 + test_grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u1 &&
97 + test_grep "^Content-Type: text/plain; charset=UTF-8" out-u2 &&
98 + test_grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u2
99 '
100
101 test_expect_success 'rebase (U/U)' '
t/t3903-stash.sh
+14 -14
@@ -20,21 +20,21 @@ test_expect_success 'setup' '
20
21 test_expect_success 'usage on cmd and subcommand invalid option' '
22 test_expect_code 129 git stash --invalid-option 2>usage &&
23 - grep "or: git stash" usage &&
23 + test_grep "or: git stash" usage &&
24
25 test_expect_code 129 git stash push --invalid-option 2>usage &&
26 - ! grep "or: git stash" usage
26 + test_grep ! "or: git stash" usage
27 '
28
29 test_expect_success 'usage on main command -h emits a summary of subcommands' '
30 test_expect_code 129 git stash -h >usage &&
31 - grep -F "usage: git stash list" usage &&
32 - grep -F "or: git stash show" usage
31 + test_grep -F "usage: git stash list" usage &&
32 + test_grep -F "or: git stash show" usage
33 '
34
35 test_expect_success 'usage for subcommands should emit subcommand usage' '
36 test_expect_code 129 git stash push -h >usage &&
37 - grep -F "usage: git stash [push" usage
37 + test_grep -F "usage: git stash [push" usage
38 '
39
40 diff_cmp () {
@@ -965,7 +965,7 @@ test_expect_success 'store updates stash ref and reflog' '
965 test $(git rev-parse stash) = $STASH_ID &&
966 git reflog --format=%H stash| grep $STASH_ID &&
967 git stash pop &&
968 - grep quux bazzy
968 + test_grep quux bazzy
969 '
970
971 test_expect_success 'handle stash specification with spaces' '
@@ -977,7 +977,7 @@ test_expect_success 'handle stash specification with spaces' '
977 echo cow >file &&
978 git stash &&
979 git stash apply "stash@{$stamp}" &&
980 - grep pig file
980 + test_grep pig file
981 '
982
983 test_expect_success 'setup stash with index and worktree changes' '
@@ -1500,9 +1500,9 @@ test_expect_success 'stash export can accept specified stashes' '
1500
1501 test_expect_success 'stash export rejects invalid arguments' '
1502 test_must_fail git stash export --print --to-ref refs/heads/invalid 2>err &&
1503 - grep "exactly one of --print and --to-ref is required" err &&
1503 + test_grep "exactly one of --print and --to-ref is required" err &&
1504 test_must_fail git stash export 2>err2 &&
1505 - grep "exactly one of --print and --to-ref is required" err2
1505 + test_grep "exactly one of --print and --to-ref is required" err2
1506 '
1507
1508 test_expect_success 'stash can import and export zero stashes' '
@@ -1519,7 +1519,7 @@ test_expect_success 'stash rejects invalid attempts to import commits' '
1519 git stash import foo &&
1520 test_must_fail git stash import HEAD 2>output &&
1521 oid=$(git rev-parse HEAD) &&
1522 - grep "$oid is not a valid exported stash commit" output &&
1522 + test_grep "$oid is not a valid exported stash commit" output &&
1523 test_cmp_rev stash@{0} t-stash0 &&
1524
1525 git checkout --orphan orphan &&
@@ -1527,7 +1527,7 @@ test_expect_success 'stash rejects invalid attempts to import commits' '
1527 git update-ref refs/heads/orphan "$(cat fake-commit)" &&
1528 oid=$(git rev-parse HEAD) &&
1529 test_must_fail git stash import orphan 2>output &&
1530 - grep "found stash commit $oid without expected prefix" output &&
1530 + test_grep "found stash commit $oid without expected prefix" output &&
1531 test_cmp_rev stash@{0} t-stash0 &&
1532
1533 git checkout --orphan orphan2 &&
@@ -1535,7 +1535,7 @@ test_expect_success 'stash rejects invalid attempts to import commits' '
1535 git update-ref refs/heads/orphan2 "$(cat fake-commit)" &&
1536 oid=$(git rev-parse HEAD) &&
1537 test_must_fail git stash import orphan2 2>output &&
1538 - grep "found root commit $oid with invalid data" output &&
1538 + test_grep "found root commit $oid with invalid data" output &&
1539 test_cmp_rev stash@{0} t-stash0
1540 '
1541
@@ -1741,7 +1741,7 @@ test_expect_success 'submodules does not affect the branch recorded in stash mes
1741 git stash push -m "custom stash for work_branch" &&
1742
1743 git stash list >../actual_stash_list.txt &&
1744 - grep "On work_branch: custom stash for work_branch" ../actual_stash_list.txt
1744 + test_grep "On work_branch: custom stash for work_branch" ../actual_stash_list.txt
1745 )
1746 '
1747
@@ -1751,7 +1751,7 @@ test_expect_success SANITIZE_LEAK 'stash show handles -- without leaking' '
1751
1752 test_expect_success 'controlled error return on unrecognized option' '
1753 test_expect_code 129 git stash show -p --invalid 2>usage &&
1754 - grep -e "^usage: git stash show" usage
1754 + test_grep -e "^usage: git stash show" usage
1755 '
1756
1757 test_expect_success 'stash.index=true implies --index' '
t/t3904-stash-patch.sh
+2 -2
@@ -103,8 +103,8 @@ test_expect_success 'stash -p with split hunk' '
103 printf "%s\n" s n y q |
104 git stash -p 2>error &&
105 test_must_be_empty error &&
106 - grep "added line 1" test &&
107 - ! grep "added line 2" test
106 + test_grep "added line 1" test &&
107 + test_grep ! "added line 2" test
108 '
109
110 test_expect_success 'stash -p not confused by GIT_PAGER_IN_USE' '
t/t3908-stash-in-worktree.sh
+1 -1
@@ -21,7 +21,7 @@ test_expect_success 'apply in subdirectory' '
21 git stash &&
22 git stash apply >out
23 ) &&
24 - grep "\.\.\/initial\.t" wt/subdir/out
24 + test_grep "\.\.\/initial\.t" wt/subdir/out
25 '
26
27 test_done
t/t4000-diff-format.sh
+1 -1
@@ -84,7 +84,7 @@ test_expect_success 'git diff-files --no-patch --patch shows the patch' '
84
85 test_expect_success 'git diff-files --no-patch --patch-with-raw shows the patch and raw data' '
86 git diff-files --no-patch --patch-with-raw >actual &&
87 - grep -q "^:100644 100755 .* $ZERO_OID M path0\$" actual &&
87 + test_grep -q "^:100644 100755 .* $ZERO_OID M path0\$" actual &&
88 tail -n +4 actual >actual-patch &&
89 compare_diff_patch expected actual-patch
90 '
t/t4001-diff-rename.sh
+2 -2
@@ -189,7 +189,7 @@ test_expect_success 'setup for many rename source candidates' '
189 M path1
190 EOF
191 test_cmp expect actual.munged &&
192 - grep warning actual.err
192 + test_grep warning actual.err
193 '
194
195 test_expect_success 'rename pretty print with nothing in common' '
@@ -258,7 +258,7 @@ test_expect_success 'diff-tree -l0 defaults to a big rename limit, not zero' '
258
259 git diff-tree -M -l0 HEAD HEAD^ >actual &&
260 # Verify that a rename from myotherfile to myfile was detected
261 - grep "myotherfile.*myfile" actual
261 + test_grep "myotherfile.*myfile" actual
262 '
263
264 test_expect_success 'basename similarity vs best similarity' '
t/t4011-diff-symlink.sh
+1 -1
@@ -140,7 +140,7 @@ test_expect_success SYMLINKS 'diff symlinks with non-existing targets' '
140 ln -s narf pinky &&
141 ln -s take\ over brain &&
142 test_must_fail git diff --no-index pinky brain >output 2>output.err &&
143 - grep narf output &&
143 + test_grep narf output &&
144 test_must_be_empty output.err
145 '
146
t/t4013-diff-various.sh
+1 -1
@@ -778,7 +778,7 @@ test_expect_success 'diff.{src,dst}Prefix ignored with --default-prefix' '
778 test_expect_success 'diff --no-renames cannot be abbreviated' '
779 test_expect_code 129 git diff --no-rename >actual 2>error &&
780 test_must_be_empty actual &&
781 - grep "invalid option: --no-rename" error
781 + test_grep "invalid option: --no-rename" error
782 '
783
784 test_done
t/t4014-format-patch.sh
+172 -172
@@ -119,17 +119,17 @@ test_expect_success 'format-patch --ignore-if-in-upstream result applies' '
119
120 test_expect_success 'commit did not screw up the log message' '
121 git cat-file commit side >actual &&
122 - grep "^Side .* with .* backslash-n" actual
122 + test_grep "^Side .* with .* backslash-n" actual
123 '
124
125 test_expect_success 'format-patch did not screw up the log message' '
126 - grep "^Subject: .*Side changes #3 with .* backslash-n" patch0 &&
127 - grep "^Subject: .*Side changes #3 with .* backslash-n" patch1
126 + test_grep "^Subject: .*Side changes #3 with .* backslash-n" patch0 &&
127 + test_grep "^Subject: .*Side changes #3 with .* backslash-n" patch1
128 '
129
130 test_expect_success 'replay did not screw up the log message' '
131 git cat-file commit rebuild-1 >actual &&
132 - grep "^Side .* with .* backslash-n" actual
132 + test_grep "^Side .* with .* backslash-n" actual
133 '
134
135 test_expect_success 'format-patch empty commit' '
@@ -145,8 +145,8 @@ test_expect_success 'extra headers' '
145 " &&
146 git format-patch --stdout main..side >patch2 &&
147 sed -e "/^\$/q" patch2 >hdrs2 &&
148 - grep "^To: R E Cipient <rcipient@example.com>\$" hdrs2 &&
149 - grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs2
148 + test_grep "^To: R E Cipient <rcipient@example.com>\$" hdrs2 &&
149 + test_grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs2
150 '
151
152 test_expect_success 'extra headers without newlines' '
@@ -154,8 +154,8 @@ test_expect_success 'extra headers without newlines' '
154 git config --add format.headers "Cc: S E Cipient <scipient@example.com>" &&
155 git format-patch --stdout main..side >patch3 &&
156 sed -e "/^\$/q" patch3 >hdrs3 &&
157 - grep "^To: R E Cipient <rcipient@example.com>\$" hdrs3 &&
158 - grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs3
157 + test_grep "^To: R E Cipient <rcipient@example.com>\$" hdrs3 &&
158 + test_grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs3
159 '
160
161 test_expect_success 'extra headers with multiple To:s' '
@@ -163,79 +163,79 @@ test_expect_success 'extra headers with multiple To:s' '
163 git config --add format.headers "To: S E Cipient <scipient@example.com>" &&
164 git format-patch --stdout main..side >patch4 &&
165 sed -e "/^\$/q" patch4 >hdrs4 &&
166 - grep "^To: R E Cipient <rcipient@example.com>,\$" hdrs4 &&
167 - grep "^ *S E Cipient <scipient@example.com>\$" hdrs4
166 + test_grep "^To: R E Cipient <rcipient@example.com>,\$" hdrs4 &&
167 + test_grep "^ *S E Cipient <scipient@example.com>\$" hdrs4
168 '
169
170 test_expect_success 'additional command line cc (ascii)' '
171 git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
172 git format-patch --cc="S E Cipient <scipient@example.com>" --stdout main..side >patch5 &&
173 sed -e "/^\$/q" patch5 >hdrs5 &&
174 - grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs5 &&
175 - grep "^ *S E Cipient <scipient@example.com>\$" hdrs5
174 + test_grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs5 &&
175 + test_grep "^ *S E Cipient <scipient@example.com>\$" hdrs5
176 '
177
178 test_expect_failure 'additional command line cc (rfc822)' '
179 git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
180 git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout main..side >patch5 &&
181 sed -e "/^\$/q" patch5 >hdrs5 &&
182 - grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs5 &&
183 - grep "^ *\"S. E. Cipient\" <scipient@example.com>\$" hdrs5
182 + test_grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs5 &&
183 + test_grep "^ *\"S. E. Cipient\" <scipient@example.com>\$" hdrs5
184 '
185
186 test_expect_success 'command line headers' '
187 git config --unset-all format.headers &&
188 git format-patch --add-header="Cc: R E Cipient <rcipient@example.com>" --stdout main..side >patch6 &&
189 sed -e "/^\$/q" patch6 >hdrs6 &&
190 - grep "^Cc: R E Cipient <rcipient@example.com>\$" hdrs6
190 + test_grep "^Cc: R E Cipient <rcipient@example.com>\$" hdrs6
191 '
192
193 test_expect_success 'configuration headers and command line headers' '
194 git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
195 git format-patch --add-header="Cc: S E Cipient <scipient@example.com>" --stdout main..side >patch7 &&
196 sed -e "/^\$/q" patch7 >hdrs7 &&
197 - grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs7 &&
198 - grep "^ *S E Cipient <scipient@example.com>\$" hdrs7
197 + test_grep "^Cc: R E Cipient <rcipient@example.com>,\$" hdrs7 &&
198 + test_grep "^ *S E Cipient <scipient@example.com>\$" hdrs7
199 '
200
201 test_expect_success 'command line To: header (ascii)' '
202 git config --unset-all format.headers &&
203 git format-patch --to="R E Cipient <rcipient@example.com>" --stdout main..side >patch8 &&
204 sed -e "/^\$/q" patch8 >hdrs8 &&
205 - grep "^To: R E Cipient <rcipient@example.com>\$" hdrs8
205 + test_grep "^To: R E Cipient <rcipient@example.com>\$" hdrs8
206 '
207
208 test_expect_failure 'command line To: header (rfc822)' '
209 git format-patch --to="R. E. Cipient <rcipient@example.com>" --stdout main..side >patch8 &&
210 sed -e "/^\$/q" patch8 >hdrs8 &&
211 - grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" hdrs8
211 + test_grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" hdrs8
212 '
213
214 test_expect_failure 'command line To: header (rfc2047)' '
215 git format-patch --to="R Ä Cipient <rcipient@example.com>" --stdout main..side >patch8 &&
216 sed -e "/^\$/q" patch8 >hdrs8 &&
217 - grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" hdrs8
217 + test_grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" hdrs8
218 '
219
220 test_expect_success 'configuration To: header (ascii)' '
221 git config format.to "R E Cipient <rcipient@example.com>" &&
222 git format-patch --stdout main..side >patch9 &&
223 sed -e "/^\$/q" patch9 >hdrs9 &&
224 - grep "^To: R E Cipient <rcipient@example.com>\$" hdrs9
224 + test_grep "^To: R E Cipient <rcipient@example.com>\$" hdrs9
225 '
226
227 test_expect_failure 'configuration To: header (rfc822)' '
228 git config format.to "R. E. Cipient <rcipient@example.com>" &&
229 git format-patch --stdout main..side >patch9 &&
230 sed -e "/^\$/q" patch9 >hdrs9 &&
231 - grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" hdrs9
231 + test_grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" hdrs9
232 '
233
234 test_expect_failure 'configuration To: header (rfc2047)' '
235 git config format.to "R Ä Cipient <rcipient@example.com>" &&
236 git format-patch --stdout main..side >patch9 &&
237 sed -e "/^\$/q" patch9 >hdrs9 &&
238 - grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" hdrs9
238 + test_grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" hdrs9
239 '
240
241 # check_patch <patch>: Verify that <patch> looks like a half-sane
@@ -250,35 +250,35 @@ test_expect_success 'format.from=false' '
250 git -c format.from=false format-patch --stdout main..side >patch &&
251 sed -e "/^\$/q" patch >hdrs &&
252 check_patch patch &&
253 - ! grep "^From: C O Mitter <committer@example.com>\$" hdrs
253 + test_grep ! "^From: C O Mitter <committer@example.com>\$" hdrs
254 '
255
256 test_expect_success 'format.from=true' '
257 git -c format.from=true format-patch --stdout main..side >patch &&
258 sed -e "/^\$/q" patch >hdrs &&
259 check_patch hdrs &&
260 - grep "^From: C O Mitter <committer@example.com>\$" hdrs
260 + test_grep "^From: C O Mitter <committer@example.com>\$" hdrs
261 '
262
263 test_expect_success 'format.from with address' '
264 git -c format.from="F R Om <from@example.com>" format-patch --stdout main..side >patch &&
265 sed -e "/^\$/q" patch >hdrs &&
266 check_patch hdrs &&
267 - grep "^From: F R Om <from@example.com>\$" hdrs
267 + test_grep "^From: F R Om <from@example.com>\$" hdrs
268 '
269
270 test_expect_success '--no-from overrides format.from' '
271 git -c format.from="F R Om <from@example.com>" format-patch --no-from --stdout main..side >patch &&
272 sed -e "/^\$/q" patch >hdrs &&
273 check_patch hdrs &&
274 - ! grep "^From: F R Om <from@example.com>\$" hdrs
274 + test_grep ! "^From: F R Om <from@example.com>\$" hdrs
275 '
276
277 test_expect_success '--from overrides format.from' '
278 git -c format.from="F R Om <from@example.com>" format-patch --from --stdout main..side >patch &&
279 sed -e "/^\$/q" patch >hdrs &&
280 check_patch hdrs &&
281 - ! grep "^From: F R Om <from@example.com>\$" hdrs
281 + test_grep ! "^From: F R Om <from@example.com>\$" hdrs
282 '
283
284 test_expect_success '--no-to overrides config.to' '
@@ -287,7 +287,7 @@ test_expect_success '--no-to overrides config.to' '
287 git format-patch --no-to --stdout main..side >patch10 &&
288 sed -e "/^\$/q" patch10 >hdrs10 &&
289 check_patch hdrs10 &&
290 - ! grep "^To: R E Cipient <rcipient@example.com>\$" hdrs10
290 + test_grep ! "^To: R E Cipient <rcipient@example.com>\$" hdrs10
291 '
292
293 test_expect_success '--no-to and --to replaces config.to' '
@@ -297,8 +297,8 @@ test_expect_success '--no-to and --to replaces config.to' '
297 --stdout main..side >patch11 &&
298 sed -e "/^\$/q" patch11 >hdrs11 &&
299 check_patch hdrs11 &&
300 - ! grep "^To: Someone <someone@out.there>\$" hdrs11 &&
301 - grep "^To: Someone Else <else@out.there>\$" hdrs11
300 + test_grep ! "^To: Someone <someone@out.there>\$" hdrs11 &&
301 + test_grep "^To: Someone Else <else@out.there>\$" hdrs11
302 '
303
304 test_expect_success '--no-cc overrides config.cc' '
@@ -307,7 +307,7 @@ test_expect_success '--no-cc overrides config.cc' '
307 git format-patch --no-cc --stdout main..side >patch12 &&
308 sed -e "/^\$/q" patch12 >hdrs12 &&
309 check_patch hdrs12 &&
310 - ! grep "^Cc: C E Cipient <rcipient@example.com>\$" hdrs12
310 + test_grep ! "^Cc: C E Cipient <rcipient@example.com>\$" hdrs12
311 '
312
313 test_expect_success '--no-add-header overrides config.headers' '
@@ -316,7 +316,7 @@ test_expect_success '--no-add-header overrides config.headers' '
316 git format-patch --no-add-header --stdout main..side >patch13 &&
317 sed -e "/^\$/q" patch13 >hdrs13 &&
318 check_patch hdrs13 &&
319 - ! grep "^Header1: B E Cipient <rcipient@example.com>\$" hdrs13
319 + test_grep ! "^Header1: B E Cipient <rcipient@example.com>\$" hdrs13
320 '
321
322 test_expect_success 'multiple files' '
@@ -508,41 +508,41 @@ test_expect_success 'cover letter config commitlistformat not set' '
508 test_expect_success 'reroll count' '
509 rm -fr patches &&
510 git format-patch -o patches --cover-letter --reroll-count 4 main..side >list &&
511 - ! grep -v "^patches/v4-000[0-3]-" list &&
511 + test_grep ! -v "^patches/v4-000[0-3]-" list &&
512 sed -n -e "/^Subject: /p" $(cat list) >subjects &&
513 - ! grep -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects
513 + test_grep ! -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects
514 '
515
516 test_expect_success 'reroll count (-v)' '
517 rm -fr patches &&
518 git format-patch -o patches --cover-letter -v4 main..side >list &&
519 - ! grep -v "^patches/v4-000[0-3]-" list &&
519 + test_grep ! -v "^patches/v4-000[0-3]-" list &&
520 sed -n -e "/^Subject: /p" $(cat list) >subjects &&
521 - ! grep -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects
521 + test_grep ! -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects
522 '
523
524 test_expect_success 'reroll count (-v) with a fractional number' '
525 rm -fr patches &&
526 git format-patch -o patches --cover-letter -v4.4 main..side >list &&
527 - ! grep -v "^patches/v4.4-000[0-3]-" list &&
527 + test_grep ! -v "^patches/v4.4-000[0-3]-" list &&
528 sed -n -e "/^Subject: /p" $(cat list) >subjects &&
529 - ! grep -v "^Subject: \[PATCH v4.4 [0-3]/3\] " subjects
529 + test_grep ! -v "^Subject: \[PATCH v4.4 [0-3]/3\] " subjects
530 '
531
532 test_expect_success 'reroll (-v) count with a non number' '
533 rm -fr patches &&
534 git format-patch -o patches --cover-letter -v4rev2 main..side >list &&
535 - ! grep -v "^patches/v4rev2-000[0-3]-" list &&
535 + test_grep ! -v "^patches/v4rev2-000[0-3]-" list &&
536 sed -n -e "/^Subject: /p" $(cat list) >subjects &&
537 - ! grep -v "^Subject: \[PATCH v4rev2 [0-3]/3\] " subjects
537 + test_grep ! -v "^Subject: \[PATCH v4rev2 [0-3]/3\] " subjects
538 '
539
540 test_expect_success 'reroll (-v) count with a non-pathname character' '
541 rm -fr patches &&
542 git format-patch -o patches --cover-letter -v4---..././../--1/.2// main..side >list &&
543 - ! grep -v "patches/v4-\.-\.-\.-1-\.2-000[0-3]-" list &&
543 + test_grep ! -v "patches/v4-\.-\.-\.-1-\.2-000[0-3]-" list &&
544 sed -n -e "/^Subject: /p" $(cat list) >subjects &&
545 - ! grep -v "^Subject: \[PATCH v4---\.\.\./\./\.\./--1/\.2// [0-3]/3\] " subjects
545 + test_grep ! -v "^Subject: \[PATCH v4---\.\.\./\./\.\./--1/\.2// [0-3]/3\] " subjects
546 '
547
548 check_threading () {
@@ -813,9 +813,9 @@ test_expect_success 'cover-letter inherits diff options' '
813 git commit -m foo &&
814 git format-patch --no-renames --cover-letter -1 &&
815 check_patch 0000-cover-letter.patch &&
816 - ! grep "file => foo .* 0 *\$" 0000-cover-letter.patch &&
816 + test_grep ! "file => foo .* 0 *\$" 0000-cover-letter.patch &&
817 git format-patch --cover-letter -1 -M &&
818 - grep "file => foo .* 0 *\$" 0000-cover-letter.patch
818 + test_grep "file => foo .* 0 *\$" 0000-cover-letter.patch
819 '
820
821 cat >expect <<EOF
@@ -924,13 +924,13 @@ test_expect_success 'format-patch from a subdirectory (3)' '
924
925 test_expect_success 'format-patch --in-reply-to' '
926 git format-patch -1 --stdout --in-reply-to "baz@foo.bar" >patch8 &&
927 - grep "^In-Reply-To: <baz@foo.bar>" patch8 &&
928 - grep "^References: <baz@foo.bar>" patch8
927 + test_grep "^In-Reply-To: <baz@foo.bar>" patch8 &&
928 + test_grep "^References: <baz@foo.bar>" patch8
929 '
930
931 test_expect_success 'format-patch --signoff' '
932 git format-patch -1 --signoff --stdout >out &&
933 - grep "^Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" out
933 + test_grep "^Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" out
934 '
935
936 test_expect_success 'format-patch --notes --signoff' '
@@ -949,27 +949,27 @@ test_expect_success 'format-patch notes output control' '
949 git notes add -m "notes config message" HEAD &&
950
951 git format-patch -1 --stdout >out &&
952 - ! grep "notes config message" out &&
952 + test_grep ! "notes config message" out &&
953 git format-patch -1 --stdout --notes >out &&
954 - grep "notes config message" out &&
954 + test_grep "notes config message" out &&
955 git format-patch -1 --stdout --no-notes >out &&
956 - ! grep "notes config message" out &&
956 + test_grep ! "notes config message" out &&
957 git format-patch -1 --stdout --notes --no-notes >out &&
958 - ! grep "notes config message" out &&
958 + test_grep ! "notes config message" out &&
959 git format-patch -1 --stdout --no-notes --notes >out &&
960 - grep "notes config message" out &&
960 + test_grep "notes config message" out &&
961
962 test_config format.notes true &&
963 git format-patch -1 --stdout >out &&
964 - grep "notes config message" out &&
964 + test_grep "notes config message" out &&
965 git format-patch -1 --stdout --notes >out &&
966 - grep "notes config message" out &&
966 + test_grep "notes config message" out &&
967 git format-patch -1 --stdout --no-notes >out &&
968 - ! grep "notes config message" out &&
968 + test_grep ! "notes config message" out &&
969 git format-patch -1 --stdout --notes --no-notes >out &&
970 - ! grep "notes config message" out &&
970 + test_grep ! "notes config message" out &&
971 git format-patch -1 --stdout --no-notes --notes >out &&
972 - grep "notes config message" out
972 + test_grep "notes config message" out
973 '
974
975 test_expect_success 'format-patch with multiple notes refs' '
@@ -979,39 +979,39 @@ test_expect_success 'format-patch with multiple notes refs' '
979 git notes --ref note2 add -m "this is note 2" HEAD &&
980
981 git format-patch -1 --stdout >out &&
982 - ! grep "this is note 1" out &&
983 - ! grep "this is note 2" out &&
982 + test_grep ! "this is note 1" out &&
983 + test_grep ! "this is note 2" out &&
984 git format-patch -1 --stdout --notes=note1 >out &&
985 - grep "this is note 1" out &&
986 - ! grep "this is note 2" out &&
985 + test_grep "this is note 1" out &&
986 + test_grep ! "this is note 2" out &&
987 git format-patch -1 --stdout --notes=note2 >out &&
988 - ! grep "this is note 1" out &&
989 - grep "this is note 2" out &&
988 + test_grep ! "this is note 1" out &&
989 + test_grep "this is note 2" out &&
990 git format-patch -1 --stdout --notes=note1 --notes=note2 >out &&
991 - grep "this is note 1" out &&
992 - grep "this is note 2" out &&
991 + test_grep "this is note 1" out &&
992 + test_grep "this is note 2" out &&
993
994 test_config format.notes note1 &&
995 git format-patch -1 --stdout >out &&
996 - grep "this is note 1" out &&
997 - ! grep "this is note 2" out &&
996 + test_grep "this is note 1" out &&
997 + test_grep ! "this is note 2" out &&
998 git format-patch -1 --stdout --no-notes >out &&
999 - ! grep "this is note 1" out &&
1000 - ! grep "this is note 2" out &&
999 + test_grep ! "this is note 1" out &&
1000 + test_grep ! "this is note 2" out &&
1001 git format-patch -1 --stdout --notes=note2 >out &&
1002 - grep "this is note 1" out &&
1003 - grep "this is note 2" out &&
1002 + test_grep "this is note 1" out &&
1003 + test_grep "this is note 2" out &&
1004 git format-patch -1 --stdout --no-notes --notes=note2 >out &&
1005 - ! grep "this is note 1" out &&
1006 - grep "this is note 2" out &&
1005 + test_grep ! "this is note 1" out &&
1006 + test_grep "this is note 2" out &&
1007
1008 git config --add format.notes note2 &&
1009 git format-patch -1 --stdout >out &&
1010 - grep "this is note 1" out &&
1011 - grep "this is note 2" out &&
1010 + test_grep "this is note 1" out &&
1011 + test_grep "this is note 2" out &&
1012 git format-patch -1 --stdout --no-notes >out &&
1013 - ! grep "this is note 1" out &&
1014 - ! grep "this is note 2" out
1013 + test_grep ! "this is note 1" out &&
1014 + test_grep ! "this is note 2" out
1015 '
1016
1017 test_expect_success 'format-patch with multiple notes refs in config' '
@@ -1024,26 +1024,26 @@ test_expect_success 'format-patch with multiple notes refs in config' '
1024
1025 git config format.notes note1 &&
1026 git format-patch -1 --stdout >out &&
1027 - grep "this is note 1" out &&
1028 - ! grep "this is note 2" out &&
1027 + test_grep "this is note 1" out &&
1028 + test_grep ! "this is note 2" out &&
1029 git config format.notes note2 &&
1030 git format-patch -1 --stdout >out &&
1031 - ! grep "this is note 1" out &&
1032 - grep "this is note 2" out &&
1031 + test_grep ! "this is note 1" out &&
1032 + test_grep "this is note 2" out &&
1033 git config --add format.notes note1 &&
1034 git format-patch -1 --stdout >out &&
1035 - grep "this is note 1" out &&
1036 - grep "this is note 2" out &&
1035 + test_grep "this is note 1" out &&
1036 + test_grep "this is note 2" out &&
1037
1038 git config --replace-all format.notes note1 &&
1039 git config --add format.notes false &&
1040 git format-patch -1 --stdout >out &&
1041 - ! grep "this is note 1" out &&
1042 - ! grep "this is note 2" out &&
1041 + test_grep ! "this is note 1" out &&
1042 + test_grep ! "this is note 2" out &&
1043 git config --add format.notes note2 &&
1044 git format-patch -1 --stdout >out &&
1045 - ! grep "this is note 1" out &&
1046 - grep "this is note 2" out
1045 + test_grep ! "this is note 1" out &&
1046 + test_grep "this is note 2" out
1047 '
1048
1049 echo "fatal: --name-only does not make sense" >expect.name-only
@@ -1095,7 +1095,7 @@ test_expect_success 'format-patch -- <path>' '
1095
1096 git format-patch main..pathspec -- file_a >output &&
1097 test_cmp expect output &&
1098 - ! grep file_b *.patch
1098 + test_grep ! file_b *.patch
1099 '
1100
1101 test_expect_success 'format-patch --ignore-if-in-upstream HEAD' '
@@ -1129,14 +1129,14 @@ test_expect_success 'format-patch --signature' '
1129 test_expect_success 'format-patch with format.signature config' '
1130 git config format.signature "config sig" &&
1131 git format-patch --stdout -1 >output &&
1132 - grep "config sig" output
1132 + test_grep "config sig" output
1133 '
1134
1135 test_expect_success 'format-patch --signature overrides format.signature' '
1136 git config format.signature "config sig" &&
1137 git format-patch --stdout --signature="overrides" -1 >output &&
1138 - ! grep "config sig" output &&
1139 - grep "overrides" output
1138 + test_grep ! "config sig" output &&
1139 + test_grep "overrides" output
1140 '
1141
1142 test_expect_success 'format-patch --no-signature ignores format.signature' '
@@ -1144,9 +1144,9 @@ test_expect_success 'format-patch --no-signature ignores format.signature' '
1144 git format-patch --stdout --signature="my sig" --no-signature \
1145 -1 >output &&
1146 check_patch output &&
1147 - ! grep "config sig" output &&
1148 - ! grep "my sig" output &&
1149 - ! grep "^-- \$" output
1147 + test_grep ! "config sig" output &&
1148 + test_grep ! "my sig" output &&
1149 + test_grep ! "^-- \$" output
1150 '
1151
1152 test_expect_success 'format-patch --signature --cover-letter' '
@@ -1161,20 +1161,20 @@ test_expect_success 'format.signature="" suppresses signatures' '
1161 git config format.signature "" &&
1162 git format-patch --stdout -1 >output &&
1163 check_patch output &&
1164 - ! grep "^-- \$" output
1164 + test_grep ! "^-- \$" output
1165 '
1166
1167 test_expect_success 'format-patch --no-signature suppresses signatures' '
1168 git config --unset-all format.signature &&
1169 git format-patch --stdout --no-signature -1 >output &&
1170 check_patch output &&
1171 - ! grep "^-- \$" output
1171 + test_grep ! "^-- \$" output
1172 '
1173
1174 test_expect_success 'format-patch --signature="" suppresses signatures' '
1175 git format-patch --stdout --signature="" -1 >output &&
1176 check_patch output &&
1177 - ! grep "^-- \$" output
1177 + test_grep ! "^-- \$" output
1178 '
1179
1180 test_expect_success 'prepare mail-signature input' '
@@ -1213,7 +1213,7 @@ test_expect_success '--no-signature suppresses format.signaturefile ' '
1213 test_config format.signaturefile mail-signature &&
1214 git format-patch --stdout --no-signature -1 >output &&
1215 check_patch output &&
1216 - ! grep "^-- \$" output
1216 + test_grep ! "^-- \$" output
1217 '
1218
1219 test_expect_success '--signature-file overrides format.signaturefile' '
@@ -1235,7 +1235,7 @@ test_expect_success '--signature overrides format.signaturefile' '
1235 test_config format.signaturefile mail-signature &&
1236 git format-patch --stdout --signature="my sig" -1 >output &&
1237 check_patch output &&
1238 - grep "my sig" output
1238 + test_grep "my sig" output
1239 '
1240
1241 test_expect_success TTY 'format-patch --stdout paginates' '
@@ -2001,10 +2001,10 @@ body" &&
2001 test_config format.coverFromDescription default &&
2002 git checkout rebuild-1 &&
2003 git format-patch --stdout --cover-letter main >actual &&
2004 - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2005 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2006 - grep "^config subject$" actual &&
2007 - grep "^body$" actual
2004 + test_grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2005 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2006 + test_grep "^config subject$" actual &&
2007 + test_grep "^body$" actual
2008 '
2009
2010 test_expect_success 'cover letter with --cover-from-description default' '
@@ -2013,10 +2013,10 @@ test_expect_success 'cover letter with --cover-from-description default' '
2013 body" &&
2014 git checkout rebuild-1 &&
2015 git format-patch --stdout --cover-letter --cover-from-description default main >actual &&
2016 - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2017 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2018 - grep "^config subject$" actual &&
2019 - grep "^body$" actual
2016 + test_grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2017 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2018 + test_grep "^config subject$" actual &&
2019 + test_grep "^body$" actual
2020 '
2021
2022 test_expect_success 'cover letter with format.coverFromDescription = none' '
@@ -2026,10 +2026,10 @@ body" &&
2026 test_config format.coverFromDescription none &&
2027 git checkout rebuild-1 &&
2028 git format-patch --stdout --cover-letter main >actual &&
2029 - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2030 - grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2031 - ! grep "^config subject$" actual &&
2032 - ! grep "^body$" actual
2029 + test_grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2030 + test_grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2031 + test_grep ! "^config subject$" actual &&
2032 + test_grep ! "^body$" actual
2033 '
2034
2035 test_expect_success 'cover letter with --cover-from-description none' '
@@ -2038,10 +2038,10 @@ test_expect_success 'cover letter with --cover-from-description none' '
2038 body" &&
2039 git checkout rebuild-1 &&
2040 git format-patch --stdout --cover-letter --cover-from-description none main >actual &&
2041 - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2042 - grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2043 - ! grep "^config subject$" actual &&
2044 - ! grep "^body$" actual
2041 + test_grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2042 + test_grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2043 + test_grep ! "^config subject$" actual &&
2044 + test_grep ! "^body$" actual
2045 '
2046
2047 test_expect_success 'cover letter with format.coverFromDescription = message' '
@@ -2051,10 +2051,10 @@ body" &&
2051 test_config format.coverFromDescription message &&
2052 git checkout rebuild-1 &&
2053 git format-patch --stdout --cover-letter main >actual &&
2054 - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2055 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2056 - grep "^config subject$" actual &&
2057 - grep "^body$" actual
2054 + test_grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2055 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2056 + test_grep "^config subject$" actual &&
2057 + test_grep "^body$" actual
2058 '
2059
2060 test_expect_success 'cover letter with --cover-from-description message' '
@@ -2063,10 +2063,10 @@ test_expect_success 'cover letter with --cover-from-description message' '
2063 body" &&
2064 git checkout rebuild-1 &&
2065 git format-patch --stdout --cover-letter --cover-from-description message main >actual &&
2066 - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2067 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2068 - grep "^config subject$" actual &&
2069 - grep "^body$" actual
2066 + test_grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2067 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2068 + test_grep "^config subject$" actual &&
2069 + test_grep "^body$" actual
2070 '
2071
2072 test_expect_success 'cover letter with format.coverFromDescription = subject' '
@@ -2076,10 +2076,10 @@ body" &&
2076 test_config format.coverFromDescription subject &&
2077 git checkout rebuild-1 &&
2078 git format-patch --stdout --cover-letter main >actual &&
2079 - grep "^Subject: \[PATCH 0/2\] config subject$" actual &&
2080 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2081 - ! grep "^config subject$" actual &&
2082 - grep "^body$" actual
2079 + test_grep "^Subject: \[PATCH 0/2\] config subject$" actual &&
2080 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2081 + test_grep ! "^config subject$" actual &&
2082 + test_grep "^body$" actual
2083 '
2084
2085 test_expect_success 'cover letter with --cover-from-description subject' '
@@ -2088,10 +2088,10 @@ test_expect_success 'cover letter with --cover-from-description subject' '
2088 body" &&
2089 git checkout rebuild-1 &&
2090 git format-patch --stdout --cover-letter --cover-from-description subject main >actual &&
2091 - grep "^Subject: \[PATCH 0/2\] config subject$" actual &&
2092 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2093 - ! grep "^config subject$" actual &&
2094 - grep "^body$" actual
2091 + test_grep "^Subject: \[PATCH 0/2\] config subject$" actual &&
2092 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2093 + test_grep ! "^config subject$" actual &&
2094 + test_grep "^body$" actual
2095 '
2096
2097 test_expect_success 'cover letter with --cover-from-description subject (UTF-8 subject line)' '
@@ -2100,8 +2100,8 @@ test_expect_success 'cover letter with --cover-from-description subject (UTF-8 s
2100 body" &&
2101 git checkout rebuild-1 &&
2102 git format-patch --stdout --cover-letter --cover-from-description subject --encode-email-headers main >actual &&
2103 - grep "^Subject: \[PATCH 0/2\] =?UTF-8?q?Caf=C3=A9=3F?=$" actual &&
2104 - ! grep "Café" actual
2103 + test_grep "^Subject: \[PATCH 0/2\] =?UTF-8?q?Caf=C3=A9=3F?=$" actual &&
2104 + test_grep ! "Café" actual
2105 '
2106
2107 test_expect_success 'cover letter with format.coverFromDescription = auto (short subject line)' '
@@ -2111,10 +2111,10 @@ body" &&
2111 test_config format.coverFromDescription auto &&
2112 git checkout rebuild-1 &&
2113 git format-patch --stdout --cover-letter main >actual &&
2114 - grep "^Subject: \[PATCH 0/2\] config subject$" actual &&
2115 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2116 - ! grep "^config subject$" actual &&
2117 - grep "^body$" actual
2114 + test_grep "^Subject: \[PATCH 0/2\] config subject$" actual &&
2115 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2116 + test_grep ! "^config subject$" actual &&
2117 + test_grep "^body$" actual
2118 '
2119
2120 test_expect_success 'cover letter with --cover-from-description auto (short subject line)' '
@@ -2123,10 +2123,10 @@ test_expect_success 'cover letter with --cover-from-description auto (short subj
2123 body" &&
2124 git checkout rebuild-1 &&
2125 git format-patch --stdout --cover-letter --cover-from-description auto main >actual &&
2126 - grep "^Subject: \[PATCH 0/2\] config subject$" actual &&
2127 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2128 - ! grep "^config subject$" actual &&
2129 - grep "^body$" actual
2126 + test_grep "^Subject: \[PATCH 0/2\] config subject$" actual &&
2127 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2128 + test_grep ! "^config subject$" actual &&
2129 + test_grep "^body$" actual
2130 '
2131
2132 test_expect_success 'cover letter with format.coverFromDescription = auto (long subject line)' '
@@ -2136,10 +2136,10 @@ body" &&
2136 test_config format.coverFromDescription auto &&
2137 git checkout rebuild-1 &&
2138 git format-patch --stdout --cover-letter main >actual &&
2139 - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2140 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2141 - grep "^this is a really long first line and it is over 100 characters long which is the threshold for long subjects$" actual &&
2142 - grep "^body$" actual
2139 + test_grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2140 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2141 + test_grep "^this is a really long first line and it is over 100 characters long which is the threshold for long subjects$" actual &&
2142 + test_grep "^body$" actual
2143 '
2144
2145 test_expect_success 'cover letter with --cover-from-description auto (long subject line)' '
@@ -2148,10 +2148,10 @@ test_expect_success 'cover letter with --cover-from-description auto (long subje
2148 body" &&
2149 git checkout rebuild-1 &&
2150 git format-patch --stdout --cover-letter --cover-from-description auto main >actual &&
2151 - grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2152 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2153 - grep "^this is a really long first line and it is over 100 characters long which is the threshold for long subjects$" actual &&
2154 - grep "^body$" actual
2151 + test_grep "^Subject: \[PATCH 0/2\] \*\*\* SUBJECT HERE \*\*\*$" actual &&
2152 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2153 + test_grep "^this is a really long first line and it is over 100 characters long which is the threshold for long subjects$" actual &&
2154 + test_grep "^body$" actual
2155 '
2156
2157 test_expect_success 'cover letter with command-line --cover-from-description overrides config' '
@@ -2161,52 +2161,52 @@ body" &&
2161 test_config format.coverFromDescription none &&
2162 git checkout rebuild-1 &&
2163 git format-patch --stdout --cover-letter --cover-from-description subject main >actual &&
2164 - grep "^Subject: \[PATCH 0/2\] config subject$" actual &&
2165 - ! grep "^\*\*\* BLURB HERE \*\*\*$" actual &&
2166 - ! grep "^config subject$" actual &&
2167 - grep "^body$" actual
2164 + test_grep "^Subject: \[PATCH 0/2\] config subject$" actual &&
2165 + test_grep ! "^\*\*\* BLURB HERE \*\*\*$" actual &&
2166 + test_grep ! "^config subject$" actual &&
2167 + test_grep "^body$" actual
2168 '
2169
2170 test_expect_success 'cover letter using branch description (1)' '
2171 git checkout rebuild-1 &&
2172 test_config branch.rebuild-1.description hello &&
2173 git format-patch --stdout --cover-letter main >actual &&
2174 - grep hello actual
2174 + test_grep hello actual
2175 '
2176
2177 test_expect_success 'cover letter using branch description (2)' '
2178 git checkout rebuild-1 &&
2179 test_config branch.rebuild-1.description hello &&
2180 git format-patch --stdout --cover-letter rebuild-1~2..rebuild-1 >actual &&
2181 - grep hello actual
2181 + test_grep hello actual
2182 '
2183
2184 test_expect_success 'cover letter using branch description (3)' '
2185 git checkout rebuild-1 &&
2186 test_config branch.rebuild-1.description hello &&
2187 git format-patch --stdout --cover-letter ^main rebuild-1 >actual &&
2188 - grep hello actual
2188 + test_grep hello actual
2189 '
2190
2191 test_expect_success 'cover letter using branch description (4)' '
2192 git checkout rebuild-1 &&
2193 test_config branch.rebuild-1.description hello &&
2194 git format-patch --stdout --cover-letter main.. >actual &&
2195 - grep hello actual
2195 + test_grep hello actual
2196 '
2197
2198 test_expect_success 'cover letter using branch description (5)' '
2199 git checkout rebuild-1 &&
2200 test_config branch.rebuild-1.description hello &&
2201 git format-patch --stdout --cover-letter -2 HEAD >actual &&
2202 - grep hello actual
2202 + test_grep hello actual
2203 '
2204
2205 test_expect_success 'cover letter using branch description (6)' '
2206 git checkout rebuild-1 &&
2207 test_config branch.rebuild-1.description hello &&
2208 git format-patch --stdout --cover-letter -2 >actual &&
2209 - grep hello actual
2209 + test_grep hello actual
2210 '
2211
2212 test_expect_success 'cover letter with --description-file' '
@@ -2219,8 +2219,8 @@ test_expect_success 'cover letter with --description-file' '
2219 git checkout rebuild-1 &&
2220 git format-patch --stdout --cover-letter --cover-from-description auto \
2221 --description-file description.txt main >actual &&
2222 - grep "^Subject: \[PATCH 0/2\] subject from file$" actual &&
2223 - grep "^body from file$" actual
2222 + test_grep "^Subject: \[PATCH 0/2\] subject from file$" actual &&
2223 + test_grep "^body from file$" actual
2224 '
2225
2226 test_expect_success 'cover letter with nothing' '
@@ -2467,7 +2467,7 @@ test_expect_success 'format-patch errors out when history involves criss-cross'
2467 test_expect_success 'format-patch format.useAutoBase whenAble history involves criss-cross' '
2468 test_config format.useAutoBase whenAble &&
2469 git format-patch -1 >patch &&
2470 - ! grep "^base-commit:" patch
2470 + test_grep ! "^base-commit:" patch
2471 '
2472
2473 test_expect_success 'format-patch format.useAutoBase option' '
@@ -2502,13 +2502,13 @@ test_expect_success 'format-patch --base overrides format.useAutoBase' '
2502 test_expect_success 'format-patch --no-base overrides format.useAutoBase' '
2503 test_config format.useAutoBase true &&
2504 git format-patch --stdout --no-base -1 >patch &&
2505 - ! grep "^base-commit:" patch
2505 + test_grep ! "^base-commit:" patch
2506 '
2507
2508 test_expect_success 'format-patch --no-base overrides format.useAutoBase whenAble' '
2509 test_config format.useAutoBase whenAble &&
2510 git format-patch --stdout --no-base -1 >patch &&
2511 - ! grep "^base-commit:" patch
2511 + test_grep ! "^base-commit:" patch
2512 '
2513
2514 test_expect_success 'format-patch --base with --attach' '
@@ -2521,7 +2521,7 @@ test_expect_success 'format-patch --base with --attach' '
2521 test_expect_success 'format-patch --attach cover-letter only is non-multipart' '
2522 test_when_finished "rm -fr patches" &&
2523 git format-patch -o patches --cover-letter --attach=mimemime --base=HEAD~ -1 &&
2524 - ! grep -E "^--+mimemime" patches/0000*.patch &&
2524 + test_grep ! -E "^--+mimemime" patches/0000*.patch &&
2525 grep -E "^--+mimemime$" patches/0001*.patch >output &&
2526 test_line_count = 2 output &&
2527 grep -E "^--+mimemime--$" patches/0001*.patch >output &&
@@ -2533,7 +2533,7 @@ test_expect_success 'format-patch with format.attach' '
2533 separator=attachment-separator &&
2534 test_config format.attach "$separator" &&
2535 filename=$(git format-patch -o patches -1) &&
2536 - grep "^Content-Type: multipart/.*$separator" "$filename"
2536 + test_grep "^Content-Type: multipart/.*$separator" "$filename"
2537 '
2538
2539 test_expect_success 'format-patch with format.attach=disabled' '
@@ -2543,7 +2543,7 @@ test_expect_success 'format-patch with format.attach=disabled' '
2543 test_config format.attach "" &&
2544 filename=$(git format-patch -o patches -1) &&
2545 # The output should not even declare content type for text/plain.
2546 - ! grep "^Content-Type: multipart/" "$filename"
2546 + test_grep ! "^Content-Type: multipart/" "$filename"
2547 '
2548
2549 test_expect_success '-c format.mboxrd format-patch' '
@@ -2674,23 +2674,23 @@ test_expect_success 'interdiff: explicit --no-cover-letter defeats implied --cov
2674
2675 test_expect_success 'format-patch does not respect diff.noprefix' '
2676 git -c diff.noprefix format-patch -1 --stdout >actual &&
2677 - grep "^--- a/blorp" actual
2677 + test_grep "^--- a/blorp" actual
2678 '
2679
2680 test_expect_success 'format-patch respects format.noprefix' '
2681 git -c format.noprefix format-patch -1 --stdout >actual &&
2682 - grep "^--- blorp" actual
2682 + test_grep "^--- blorp" actual
2683 '
2684
2685 test_expect_success 'format.noprefix=false' '
2686 git -c format.noprefix=false format-patch -1 --stdout >actual &&
2687 - grep "^--- a/blorp" actual
2687 + test_grep "^--- a/blorp" actual
2688 '
2689
2690 test_expect_success 'format-patch --default-prefix overrides format.noprefix' '
2691 git -c format.noprefix \
2692 format-patch -1 --default-prefix --stdout >actual &&
2693 - grep "^--- a/blorp" actual
2693 + test_grep "^--- a/blorp" actual
2694 '
2695
2696 test_expect_success 'errors on format.noprefix which is not boolean' '
t/t4015-diff-whitespace.sh
+8 -8
@@ -638,14 +638,14 @@ test_expect_success 'check mixed spaces and tabs in indent' '
638 # This is indented with SP HT SP.
639 echo " foo();" >x &&
640 test_must_fail git diff --check >check &&
641 - grep "space before tab in indent" check
641 + test_grep "space before tab in indent" check
642 '
643
644 test_expect_success 'check mixed tabs and spaces in indent' '
645 # This is indented with HT SP HT.
646 echo " foo();" >x &&
647 test_must_fail git diff --check >check &&
648 - grep "space before tab in indent" check
648 + test_grep "space before tab in indent" check
649 '
650
651 test_expect_success 'check with no whitespace errors' '
@@ -891,14 +891,14 @@ test_expect_success 'line numbers in --check output are correct' '
891 echo "" >x &&
892 echo "foo(); " >>x &&
893 test_must_fail git diff --check >check &&
894 - grep "x:2:" check
894 + test_grep "x:2:" check
895 '
896
897 test_expect_success 'checkdiff detects new trailing blank lines (1)' '
898 echo "foo();" >x &&
899 echo "" >>x &&
900 test_must_fail git diff --check >check &&
901 - grep "new blank line" check
901 + test_grep "new blank line" check
902 '
903
904 test_expect_success 'checkdiff detects new trailing blank lines (2)' '
@@ -906,7 +906,7 @@ test_expect_success 'checkdiff detects new trailing blank lines (2)' '
906 git add x &&
907 test_write_lines a "" "" "" "" >x &&
908 test_must_fail git diff --check >check &&
909 - grep "new blank line" check
909 + test_grep "new blank line" check
910 '
911
912 test_expect_success 'checkdiff allows new blank lines' '
@@ -1018,7 +1018,7 @@ test_expect_success 'combined diff with autocrlf conversion' '
1018
1019 git diff >actual.raw &&
1020 sed -e "1,/^@@@/d" actual.raw >actual &&
1021 - ! grep "^-" actual
1021 + test_grep ! "^-" actual
1022
1023 '
1024
@@ -2166,8 +2166,8 @@ test_expect_success 'move detection with submodules' '
2166
2167 # no move detection as the moved line is across repository boundaries.
2168 test_decode_color <actual >decoded_actual &&
2169 - ! grep BGREEN decoded_actual &&
2170 - ! grep BRED decoded_actual &&
2169 + test_grep ! BGREEN decoded_actual &&
2170 + test_grep ! BRED decoded_actual &&
2171
2172 # nor did we mess with it another way
2173 git diff --submodule=diff --color >expect.raw &&
t/t4017-diff-retval.sh
+1 -1
@@ -139,7 +139,7 @@ test_expect_success 'check honors conflict marker length' '
139
140 test_expect_success 'option errors are not confused by --exit-code' '
141 test_must_fail git diff --exit-code --nonsense 2>err &&
142 - grep '^usage:' err
142 + test_grep '^usage:' err
143 '
144
145 for option in --exit-code --quiet
t/t4018-diff-funcname.sh
+1 -1
@@ -115,7 +115,7 @@ for i in $(git ls-files)
115 do
116 test_expect_success "hunk header: $i" "
117 git diff -U1 $i >actual &&
118 - grep '@@ .* @@.*RIGHT' actual
118 + test_grep '@@ .* @@.*RIGHT' actual
119 "
120 done
121
t/t4019-diff-wserror.sh
+4 -4
@@ -251,8 +251,8 @@ test_expect_success 'trailing empty lines (1)' '
251
252 rm -f .gitattributes &&
253 test_must_fail git diff --check >output &&
254 - grep "new blank line at" output &&
255 - grep "trailing whitespace" output
254 + test_grep "new blank line at" output &&
255 + test_grep "trailing whitespace" output
256
257 '
258
@@ -280,8 +280,8 @@ test_expect_success 'do not color trailing cr in context' '
280 git add G &&
281 echo BBBQ | tr Q "\015" >>G &&
282 git diff --color G | tr "\015" Q >output &&
283 - grep "BBB.*${blue_grep}Q" output &&
284 - grep "AAA.*\[mQ" output
283 + test_grep "BBB.*${blue_grep}Q" output &&
284 + test_grep "AAA.*\[mQ" output
285
286 '
287
t/t4020-diff-external.sh
+9 -9
@@ -34,13 +34,13 @@ test_expect_success 'GIT_EXTERNAL_DIFF environment' '
34
35 test_expect_success 'GIT_EXTERNAL_DIFF environment should apply only to diff' '
36 GIT_EXTERNAL_DIFF=echo git log -p -1 HEAD >out &&
37 - grep "^diff --git a/file b/file" out
37 + test_grep "^diff --git a/file b/file" out
38
39 '
40
41 test_expect_success 'GIT_EXTERNAL_DIFF environment and --no-ext-diff' '
42 GIT_EXTERNAL_DIFF=echo git diff --no-ext-diff >out &&
43 - grep "^diff --git a/file b/file" out
43 + test_grep "^diff --git a/file b/file" out
44
45 '
46
@@ -86,13 +86,13 @@ test_expect_success 'diff.external' '
86 test_expect_success 'diff.external should apply only to diff' '
87 test_config diff.external echo &&
88 git log -p -1 HEAD >out &&
89 - grep "^diff --git a/file b/file" out
89 + test_grep "^diff --git a/file b/file" out
90 '
91
92 test_expect_success 'diff.external and --no-ext-diff' '
93 test_config diff.external echo &&
94 git diff --no-ext-diff >out &&
95 - grep "^diff --git a/file b/file" out
95 + test_grep "^diff --git a/file b/file" out
96 '
97
98 test_expect_success 'diff attribute' '
@@ -113,13 +113,13 @@ test_expect_success 'diff attribute' '
113
114 test_expect_success 'diff attribute should apply only to diff' '
115 git log -p -1 HEAD >out &&
116 - grep "^diff --git a/file b/file" out
116 + test_grep "^diff --git a/file b/file" out
117
118 '
119
120 test_expect_success 'diff attribute and --no-ext-diff' '
121 git diff --no-ext-diff >out &&
122 - grep "^diff --git a/file b/file" out
122 + test_grep "^diff --git a/file b/file" out
123
124 '
125
@@ -140,13 +140,13 @@ test_expect_success 'diff attribute' '
140
141 test_expect_success 'diff attribute should apply only to diff' '
142 git log -p -1 HEAD >out &&
143 - grep "^diff --git a/file b/file" out
143 + test_grep "^diff --git a/file b/file" out
144
145 '
146
147 test_expect_success 'diff attribute and --no-ext-diff' '
148 git diff --no-ext-diff >out &&
149 - grep "^diff --git a/file b/file" out
149 + test_grep "^diff --git a/file b/file" out
150
151 '
152
@@ -178,7 +178,7 @@ test_expect_success 'attributes trump GIT_EXTERNAL_DIFF and diff.external' '
178 test_expect_success 'no diff with -diff' '
179 echo >.gitattributes "file -diff" &&
180 git diff >out &&
181 - grep Binary out
181 + test_grep Binary out
182 '
183
184 check_external_diff () {
t/t4021-format-patch-numbered.sh
+2 -2
@@ -94,7 +94,7 @@ test_expect_success 'format.numbered && --no-numbered' '
94 test_expect_success 'format.numbered && --keep-subject' '
95
96 git format-patch --keep-subject --stdout HEAD^ >patch4a &&
97 - grep "^Subject: Third" patch4a
97 + test_grep "^Subject: Third" patch4a
98
99 '
100
@@ -123,7 +123,7 @@ test_expect_success 'format.numbered = auto && --no-numbered' '
123 test_expect_success '--start-number && --numbered' '
124
125 git format-patch --start-number 3 --numbered --stdout HEAD~1 > patch8 &&
126 - grep "^Subject: \[PATCH 3/3\]" patch8
126 + test_grep "^Subject: \[PATCH 3/3\]" patch8
127 '
128
129 test_expect_success 'single patch with cover-letter defaults to numbers' '
t/t4022-diff-rewrite.sh
+7 -7
@@ -58,13 +58,13 @@ test_expect_success 'suppress deletion diff with -D' '
58 test_expect_success 'show deletion diff with -B' '
59
60 git diff -B -- test >actual &&
61 - grep "Linus Torvalds" actual
61 + test_grep "Linus Torvalds" actual
62 '
63
64 test_expect_success 'suppress deletion diff with -B -D' '
65
66 git diff -B -D -- test >actual &&
67 - grep -v "Linus Torvalds" actual
67 + test_grep -v "Linus Torvalds" actual
68 '
69
70 test_expect_success 'prepare a file that ends with an incomplete line' '
@@ -82,19 +82,19 @@ test_expect_success 'rewrite the middle 90% of sequence file and terminate with
82
83 test_expect_success 'confirm that sequence file is considered a rewrite' '
84 git diff -B seq >res &&
85 - grep "dissimilarity index" res
85 + test_grep "dissimilarity index" res
86 '
87
88 test_expect_success 'no newline at eof is on its own line without -B' '
89 git diff seq >res &&
90 - grep "^\\\\ " res &&
91 - ! grep "^..*\\\\ " res
90 + test_grep "^\\\\ " res &&
91 + test_grep ! "^..*\\\\ " res
92 '
93
94 test_expect_success 'no newline at eof is on its own line with -B' '
95 git diff -B seq >res &&
96 - grep "^\\\\ " res &&
97 - ! grep "^..*\\\\ " res
96 + test_grep "^\\\\ " res &&
97 + test_grep ! "^..*\\\\ " res
98 '
99
100 test_done
t/t4028-format-patch-mime-headers.sh
+3 -3
@@ -17,15 +17,15 @@ test_expect_success 'create commit with utf-8 body' '
17 test_expect_success 'patch has mime headers' '
18 rm -f 0001-two.patch &&
19 git format-patch HEAD^ &&
20 - grep -i "content-type: text/plain; charset=utf-8" 0001-two.patch
20 + test_grep -i "content-type: text/plain; charset=utf-8" 0001-two.patch
21 '
22
23 test_expect_success 'patch has mime and extra headers' '
24 rm -f 0001-two.patch &&
25 git config format.headers "x-foo: bar" &&
26 git format-patch HEAD^ &&
27 - grep -i "x-foo: bar" 0001-two.patch &&
28 - grep -i "content-type: text/plain; charset=utf-8" 0001-two.patch
27 + test_grep -i "x-foo: bar" 0001-two.patch &&
28 + test_grep -i "content-type: text/plain; charset=utf-8" 0001-two.patch
29 '
30
31 test_done
t/t4031-diff-rewrite-binary.sh
+9 -9
@@ -29,32 +29,32 @@ test_expect_success 'create binary file with changes' '
29
30 test_expect_success 'vanilla diff is binary' '
31 git diff >diff &&
32 - grep "Binary files a/file and b/file differ" diff
32 + test_grep "Binary files a/file and b/file differ" diff
33 '
34
35 test_expect_success 'rewrite diff is binary' '
36 git diff -B >diff &&
37 - grep "dissimilarity index" diff &&
38 - grep "Binary files a/file and b/file differ" diff
37 + test_grep "dissimilarity index" diff &&
38 + test_grep "Binary files a/file and b/file differ" diff
39 '
40
41 test_expect_success 'rewrite diff can show binary patch' '
42 git diff -B --binary >diff &&
43 - grep "dissimilarity index" diff &&
44 - grep "GIT binary patch" diff
43 + test_grep "dissimilarity index" diff &&
44 + test_grep "GIT binary patch" diff
45 '
46
47 test_expect_success 'rewrite diff --numstat shows binary changes' '
48 git diff -B --numstat --summary >diff &&
49 - grep -e "- - " diff &&
50 - grep " rewrite file" diff
49 + test_grep -e "- - " diff &&
50 + test_grep " rewrite file" diff
51 '
52
53 test_expect_success 'diff --stat counts binary rewrite as 0 lines' '
54 git diff -B --stat --summary >diff &&
55 - grep "Bin" diff &&
55 + test_grep "Bin" diff &&
56 test_grep "0 insertions.*0 deletions" diff &&
57 - grep " rewrite file" diff
57 + test_grep " rewrite file" diff
58 '
59
60 test_expect_success 'setup textconv' '
t/t4033-diff-patience.sh
+1 -1
@@ -10,7 +10,7 @@ test_expect_success '--ignore-space-at-eol with a single appended character' '
10 printf "a\nbX\nc\n" >post &&
11 test_must_fail git diff --no-index \
12 --patience --ignore-space-at-eol pre post >diff &&
13 - grep "^+.*X" diff
13 + test_grep "^+.*X" diff
14 '
15
16 test_diff_frobnitz "patience"
t/t4036-format-patch-signer-mime.sh
+3 -3
@@ -19,14 +19,14 @@ test_expect_success setup '
19 test_expect_success 'format normally' '
20
21 git format-patch --stdout -1 >output &&
22 - ! grep Content-Type output
22 + test_grep ! Content-Type output
23
24 '
25
26 test_expect_success 'format with signoff without funny signer name' '
27
28 git format-patch -s --stdout -1 >output &&
29 - ! grep Content-Type output
29 + test_grep ! Content-Type output
30
31 '
32
@@ -34,7 +34,7 @@ test_expect_success 'format with non ASCII signer name' '
34
35 GIT_COMMITTER_NAME="はまの ふにおう" \
36 git format-patch -s --stdout -1 >output &&
37 - grep Content-Type output
37 + test_grep Content-Type output
38
39 '
40
t/t4038-diff-combined.sh
+3 -3
@@ -100,7 +100,7 @@ test_expect_success 'diagnose truncated file' '
100 git add file &&
101 git commit --amend -C HEAD &&
102 git show >out &&
103 - grep "diff --cc file" out
103 + test_grep "diff --cc file" out
104 '
105
106 test_expect_success 'setup for --cc --raw' '
@@ -118,13 +118,13 @@ test_expect_success 'check --cc --raw with four trees' '
118 four_trees=$(echo "$trees" | sed -e 4q) &&
119 git diff --cc --raw $four_trees $base_tree >out &&
120 # Check for four leading colons in the output:
121 - grep "^::::[^:]" out
121 + test_grep "^::::[^:]" out
122 '
123
124 test_expect_success 'check --cc --raw with forty trees' '
125 git diff --cc --raw $trees $base_tree >out &&
126 # Check for forty leading colons in the output:
127 - grep "^::::::::::::::::::::::::::::::::::::::::[^:]" out
127 + test_grep "^::::::::::::::::::::::::::::::::::::::::[^:]" out
128 '
129
130 test_expect_success 'setup combined ignore spaces' '
t/t4051-diff-function-context.sh
+19 -19
@@ -86,15 +86,15 @@ test_expect_success 'setup' '
86 check_diff changed_hello 'changed function'
87
88 test_expect_success ' context includes comment' '
89 - grep "^ .*Hello comment" changed_hello.diff
89 + test_grep "^ .*Hello comment" changed_hello.diff
90 '
91
92 test_expect_success ' context includes begin' '
93 - grep "^ .*Begin of hello" changed_hello.diff
93 + test_grep "^ .*Begin of hello" changed_hello.diff
94 '
95
96 test_expect_success ' context includes end' '
97 - grep "^ .*End of hello" changed_hello.diff
97 + test_grep "^ .*End of hello" changed_hello.diff
98 '
99
100 test_expect_success ' context does not include other functions' '
@@ -112,11 +112,11 @@ test_expect_success ' context does not include trailing empty lines' '
112 check_diff changed_includes 'changed includes'
113
114 test_expect_success ' context includes begin' '
115 - grep "^ .*Begin.h" changed_includes.diff
115 + test_grep "^ .*Begin.h" changed_includes.diff
116 '
117
118 test_expect_success ' context includes end' '
119 - grep "^ .*End.h" changed_includes.diff
119 + test_grep "^ .*End.h" changed_includes.diff
120 '
121
122 test_expect_success ' context does not include other functions' '
@@ -130,11 +130,11 @@ test_expect_success ' context does not include trailing empty lines' '
130 check_diff appended 'appended function'
131
132 test_expect_success ' context includes begin' '
133 - grep "^[+].*Begin of first part" appended.diff
133 + test_grep "^[+].*Begin of first part" appended.diff
134 '
135
136 test_expect_success ' context includes end' '
137 - grep "^[+].*End of first part" appended.diff
137 + test_grep "^[+].*End of first part" appended.diff
138 '
139
140 test_expect_success ' context does not include other functions' '
@@ -144,11 +144,11 @@ test_expect_success ' context does not include other functions' '
144 check_diff extended 'appended function part'
145
146 test_expect_success ' context includes begin' '
147 - grep "^ .*Begin of first part" extended.diff
147 + test_grep "^ .*Begin of first part" extended.diff
148 '
149
150 test_expect_success ' context includes end' '
151 - grep "^[+].*End of second part" extended.diff
151 + test_grep "^[+].*End of second part" extended.diff
152 '
153
154 test_expect_success ' context does not include other functions' '
@@ -162,11 +162,11 @@ test_expect_success ' context does not include preceding empty lines' '
162 check_diff long_common_tail 'change with long common tail and no context' -U0
163
164 test_expect_success ' context includes begin' '
165 - grep "^ .*Begin of first part" long_common_tail.diff
165 + test_grep "^ .*Begin of first part" long_common_tail.diff
166 '
167
168 test_expect_success ' context includes end' '
169 - grep "^ .*End of second part" long_common_tail.diff
169 + test_grep "^ .*End of second part" long_common_tail.diff
170 '
171
172 test_expect_success ' context does not include other functions' '
@@ -180,13 +180,13 @@ test_expect_success ' context does not include preceding empty lines' '
180 check_diff changed_hello_appended 'changed function plus appended function'
181
182 test_expect_success ' context includes begin' '
183 - grep "^ .*Begin of hello" changed_hello_appended.diff &&
184 - grep "^[+].*Begin of first part" changed_hello_appended.diff
183 + test_grep "^ .*Begin of hello" changed_hello_appended.diff &&
184 + test_grep "^[+].*Begin of first part" changed_hello_appended.diff
185 '
186
187 test_expect_success ' context includes end' '
188 - grep "^ .*End of hello" changed_hello_appended.diff &&
189 - grep "^[+].*End of first part" changed_hello_appended.diff
188 + test_grep "^ .*End of hello" changed_hello_appended.diff &&
189 + test_grep "^[+].*End of first part" changed_hello_appended.diff
190 '
191
192 test_expect_success ' context does not include other functions' '
@@ -196,13 +196,13 @@ test_expect_success ' context does not include other functions' '
196 check_diff changed_hello_dummy 'changed two consecutive functions'
197
198 test_expect_success ' context includes begin' '
199 - grep "^ .*Begin of hello" changed_hello_dummy.diff &&
200 - grep "^ .*Begin of dummy" changed_hello_dummy.diff
199 + test_grep "^ .*Begin of hello" changed_hello_dummy.diff &&
200 + test_grep "^ .*Begin of dummy" changed_hello_dummy.diff
201 '
202
203 test_expect_success ' context includes end' '
204 - grep "^ .*End of hello" changed_hello_dummy.diff &&
205 - grep "^ .*End of dummy" changed_hello_dummy.diff
204 + test_grep "^ .*End of hello" changed_hello_dummy.diff &&
205 + test_grep "^ .*End of dummy" changed_hello_dummy.diff
206 '
207
208 test_expect_success ' overlapping hunks are merged' '
t/t4053-diff-no-index.sh
+2 -2
@@ -283,14 +283,14 @@ test_expect_success "diff --no-index -R treats '-' as stdin" '
283
284 test_expect_success 'diff --no-index refuses to diff stdin and a directory' '
285 test_must_fail git diff --no-index -- - a </dev/null 2>err &&
286 - grep "fatal: cannot compare stdin to a directory" err
286 + test_grep "fatal: cannot compare stdin to a directory" err
287 '
288
289 test_expect_success PIPE 'diff --no-index refuses to diff a named pipe and a directory' '
290 test_when_finished "rm -f pipe" &&
291 mkfifo pipe &&
292 test_must_fail git diff --no-index -- pipe a 2>err &&
293 - grep "fatal: cannot compare a named pipe to a directory" err
293 + test_grep "fatal: cannot compare a named pipe to a directory" err
294 '
295
296 test_expect_success PIPE,SYMLINKS 'diff --no-index reads from pipes' '
t/t4063-diff-blobs.sh
+1 -1
@@ -47,7 +47,7 @@ test_expect_success 'sha1 diff uses arguments as paths' '
47 check_paths $sha1_one $sha1_two
48 '
49 test_expect_success 'sha1 diff has no mode change' '
50 - ! grep mode diff
50 + test_grep ! mode diff
51 '
52
53 test_expect_success 'diff by tree:path (run)' '
t/t4065-diff-anchored.sh
+13 -13
@@ -10,11 +10,11 @@ test_expect_success '--anchored' '
10
11 # normally, c is moved to produce the smallest diff
12 test_expect_code 1 git diff --no-index pre post >diff &&
13 - grep "^+c" diff &&
13 + test_grep "^+c" diff &&
14
15 # with anchor, a is moved
16 test_expect_code 1 git diff --no-index --anchored=c pre post >diff &&
17 - grep "^+a" diff
17 + test_grep "^+a" diff
18 '
19
20 test_expect_success '--anchored multiple' '
@@ -23,13 +23,13 @@ test_expect_success '--anchored multiple' '
23
24 # with 1 anchor, c is not moved, but f is moved
25 test_expect_code 1 git diff --no-index --anchored=c pre post >diff &&
26 - grep "^+a" diff && # a is moved instead of c
27 - grep "^+f" diff &&
26 + test_grep "^+a" diff && # a is moved instead of c
27 + test_grep "^+f" diff &&
28
29 # with 2 anchors, c and f are not moved
30 test_expect_code 1 git diff --no-index --anchored=c --anchored=f pre post >diff &&
31 - grep "^+a" diff &&
32 - grep "^+d" diff # d is moved instead of f
31 + test_grep "^+a" diff &&
32 + test_grep "^+d" diff # d is moved instead of f
33 '
34
35 test_expect_success '--anchored with nonexistent line has no effect' '
@@ -37,7 +37,7 @@ test_expect_success '--anchored with nonexistent line has no effect' '
37 printf "c\na\nb\n" >post &&
38
39 test_expect_code 1 git diff --no-index --anchored=x pre post >diff &&
40 - grep "^+c" diff
40 + test_grep "^+c" diff
41 '
42
43 test_expect_success '--anchored with non-unique line has no effect' '
@@ -45,7 +45,7 @@ test_expect_success '--anchored with non-unique line has no effect' '
45 printf "c\na\nb\nc\nd\ne\n" >post &&
46
47 test_expect_code 1 git diff --no-index --anchored=c pre post >diff &&
48 - grep "^+c" diff
48 + test_grep "^+c" diff
49 '
50
51 test_expect_success 'diff still produced with impossible multiple --anchored' '
@@ -66,16 +66,16 @@ test_expect_success 'later algorithm arguments override earlier ones' '
66 printf "c\na\nb\n" >post &&
67
68 test_expect_code 1 git diff --no-index --patience --anchored=c pre post >diff &&
69 - grep "^+a" diff &&
69 + test_grep "^+a" diff &&
70
71 test_expect_code 1 git diff --no-index --anchored=c --patience pre post >diff &&
72 - grep "^+c" diff &&
72 + test_grep "^+c" diff &&
73
74 test_expect_code 1 git diff --no-index --histogram --anchored=c pre post >diff &&
75 - grep "^+a" diff &&
75 + test_grep "^+a" diff &&
76
77 test_expect_code 1 git diff --no-index --anchored=c --histogram pre post >diff &&
78 - grep "^+c" diff
78 + test_grep "^+c" diff
79 '
80
81 test_expect_success '--anchored works with other commands like "git show"' '
@@ -88,7 +88,7 @@ test_expect_success '--anchored works with other commands like "git show"' '
88
89 # with anchor, a is moved
90 git show --patience --anchored=c >diff &&
91 - grep "^+a" diff
91 + test_grep "^+a" diff
92 '
93
94 test_done
t/t4067-diff-partial-clone.sh
+6 -6
@@ -70,9 +70,9 @@ test_expect_success 'diff skips same-OID blobs' '
70
71 # Ensure that only a and another-a are fetched.
72 GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff HEAD^ HEAD &&
73 - grep "want $(cat hash-old-a)" trace &&
74 - grep "want $(cat hash-new-a)" trace &&
75 - ! grep "want $(cat hash-b)" trace
73 + test_grep "want $(cat hash-old-a)" trace &&
74 + test_grep "want $(cat hash-new-a)" trace &&
75 + test_grep ! "want $(cat hash-b)" trace
76 '
77
78 test_expect_success 'when fetching missing objects, diff skips GITLINKs' '
@@ -103,8 +103,8 @@ test_expect_success 'when fetching missing objects, diff skips GITLINKs' '
103 # Ensure that a and another-a are fetched, and check (by successful
104 # execution of the diff) that no invalid OIDs are sent.
105 GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff HEAD^ HEAD &&
106 - grep "want $(cat hash-old-a)" trace &&
107 - grep "want $(cat hash-new-a)" trace
106 + test_grep "want $(cat hash-old-a)" trace &&
107 + test_grep "want $(cat hash-new-a)" trace
108 '
109
110 test_expect_success 'diff with rename detection batches blobs' '
@@ -127,7 +127,7 @@ test_expect_success 'diff with rename detection batches blobs' '
127 # Ensure that there is exactly 1 negotiation by checking that there is
128 # only 1 "done" line sent. ("done" marks the end of negotiation.)
129 GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff --raw -M HEAD^ HEAD >out &&
130 - grep ":100644 100644.*R[0-9][0-9][0-9].*b.*c" out &&
130 + test_grep ":100644 100644.*R[0-9][0-9][0-9].*b.*c" out &&
131 grep "fetch> done" trace >done_lines &&
132 test_line_count = 1 done_lines
133 '
t/t4073-diff-stat-name-width.sh
+12 -12
@@ -21,41 +21,41 @@ test_expect_success 'setup' '
21
22 test_expect_success 'test name-width long enough for filepath' '
23 git diff HEAD~1 HEAD --stat --stat-name-width=12 >out &&
24 - grep "d你好/f再见 |" out &&
24 + test_grep "d你好/f再见 |" out &&
25 git diff HEAD~1 HEAD --stat --stat-name-width=11 >out &&
26 - grep "d你好/f再见 |" out
26 + test_grep "d你好/f再见 |" out
27 '
28
29 test_expect_success 'test name-width not long enough for dir name' '
30 git diff HEAD~1 HEAD --stat --stat-name-width=10 >out &&
31 - grep ".../f再见 |" out &&
31 + test_grep ".../f再见 |" out &&
32 git diff HEAD~1 HEAD --stat --stat-name-width=9 >out &&
33 - grep ".../f再见 |" out
33 + test_grep ".../f再见 |" out
34 '
35
36 test_expect_success 'test name-width not long enough for slash' '
37 git diff HEAD~1 HEAD --stat --stat-name-width=8 >out &&
38 - grep "...f再见 |" out
38 + test_grep "...f再见 |" out
39 '
40
41 test_expect_success 'test name-width not long enough for file name' '
42 git diff HEAD~1 HEAD --stat --stat-name-width=7 >out &&
43 - grep "...再见 |" out &&
43 + test_grep "...再见 |" out &&
44 git diff HEAD~1 HEAD --stat --stat-name-width=6 >out &&
45 - grep "...见 |" out &&
45 + test_grep "...见 |" out &&
46 git diff HEAD~1 HEAD --stat --stat-name-width=5 >out &&
47 - grep "...见 |" out &&
47 + test_grep "...见 |" out &&
48 git diff HEAD~1 HEAD --stat --stat-name-width=4 >out &&
49 - grep "... |" out
49 + test_grep "... |" out
50 '
51
52 test_expect_success 'test name-width minimum length' '
53 git diff HEAD~1 HEAD --stat --stat-name-width=3 >out &&
54 - grep "... |" out &&
54 + test_grep "... |" out &&
55 git diff HEAD~1 HEAD --stat --stat-name-width=2 >out &&
56 - grep "... |" out &&
56 + test_grep "... |" out &&
57 git diff HEAD~1 HEAD --stat --stat-name-width=1 >out &&
58 - grep "... |" out
58 + test_grep "... |" out
59 '
60
61 test_done
t/t4103-apply-binary.sh
+1 -1
@@ -181,7 +181,7 @@ test_expect_success PERL_TEST_HELPERS 'reject truncated binary diff' '
181 do_reset &&
182 test_must_fail git apply patch.trunc 2>err &&
183 line=$(awk "END { print NR + 1 }" patch.trunc) &&
184 - grep "error: corrupt binary patch at patch.trunc:$line: " err
184 + test_grep "error: corrupt binary patch at patch.trunc:$line: " err
185 '
186
187 test_expect_success 'reject unrecognized binary diff' '
t/t4120-apply-popt.sh
+1 -1
@@ -18,7 +18,7 @@ test_expect_success setup '
18 git mv sub süb &&
19 echo B >süb/file1 &&
20 git diff >patch.escaped &&
21 - grep "[\]" patch.escaped &&
21 + test_grep "[\]" patch.escaped &&
22 rm süb/file1 &&
23 rmdir süb
24 '
t/t4124-apply-ws-rule.sh
+5 -5
@@ -222,8 +222,8 @@ test_expect_success 'trailing whitespace & no newline at the end of file' '
222 >target &&
223 create_patch >patch-file &&
224 git apply --whitespace=fix patch-file &&
225 - grep "newline$" target &&
226 - grep "^$" target
225 + test_grep "newline$" target &&
226 + test_grep "^$" target
227 '
228
229 test_expect_success 'blank at EOF with --whitespace=fix (1)' '
@@ -287,7 +287,7 @@ test_expect_success 'blank at EOF with --whitespace=warn' '
287 git checkout one &&
288 git apply --whitespace=warn patch 2>error &&
289 test_cmp expect one &&
290 - grep "new blank line at EOF" error
290 + test_grep "new blank line at EOF" error
291 '
292
293 test_expect_success 'blank at EOF with --whitespace=error' '
@@ -300,7 +300,7 @@ test_expect_success 'blank at EOF with --whitespace=error' '
300 git checkout one &&
301 test_must_fail git apply --whitespace=error patch 2>error &&
302 test_cmp expect one &&
303 - grep "new blank line at EOF" error
303 + test_grep "new blank line at EOF" error
304 '
305
306 test_expect_success 'blank but not empty at EOF' '
@@ -313,7 +313,7 @@ test_expect_success 'blank but not empty at EOF' '
313 git checkout one &&
314 git apply --whitespace=warn patch 2>error &&
315 test_cmp expect one &&
316 - grep "new blank line at EOF" error
316 + test_grep "new blank line at EOF" error
317 '
318
319 test_expect_success 'applying beyond EOF requires one non-blank context line' '
t/t4128-apply-root.sh
+1 -1
@@ -138,7 +138,7 @@ test_expect_success 'apply --directory (delete file)' '
138 git add some/sub/dir/delfile &&
139 git apply --directory=some/sub/dir/ --index patch &&
140 git ls-files >out &&
141 - ! grep delfile out
141 + test_grep ! delfile out
142 '
143
144 cat > patch << 'EOF'
t/t4140-apply-ita.sh
+2 -2
@@ -14,11 +14,11 @@ test_expect_success setup '
14 cat blueprint >test-file &&
15 git add -N test-file &&
16 git diff >creation-patch &&
17 - grep "new file mode 100644" creation-patch &&
17 + test_grep "new file mode 100644" creation-patch &&
18
19 rm -f test-file &&
20 git diff >deletion-patch &&
21 - grep "deleted file mode 100644" deletion-patch &&
21 + test_grep "deleted file mode 100644" deletion-patch &&
22
23 git rm -f test-file &&
24 test_write_lines 6 >>committed-file &&
t/t4141-apply-too-large.sh
+1 -1
@@ -16,7 +16,7 @@ test_expect_success EXPENSIVE 'git apply rejects patches that are too large' '
16 EOF
17 test-tool genzeros
18 } | test_copy_bytes $sz | test_must_fail git apply 2>err &&
19 - grep "patch too large" err
19 + test_grep "patch too large" err
20 '
21
22 test_done
t/t4150-am.sh
+24 -24
@@ -580,7 +580,7 @@ test_expect_success 'am --keep really keeps the subject' '
580 git am --keep patch4 &&
581 test_path_is_missing .git/rebase-apply &&
582 git cat-file commit HEAD >actual &&
583 - grep "Re: Re: Re: \[PATCH 1/5 v2\] \[foo\] third" actual
583 + test_grep "Re: Re: Re: \[PATCH 1/5 v2\] \[foo\] third" actual
584 '
585
586 test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
@@ -590,7 +590,7 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
590 git am --keep-non-patch patch4 &&
591 test_path_is_missing .git/rebase-apply &&
592 git cat-file commit HEAD >actual &&
593 - grep "^\[foo\] third" actual
593 + test_grep "^\[foo\] third" actual
594 '
595
596 test_expect_success 'setup am -3' '
@@ -642,7 +642,7 @@ test_expect_success 'am with config am.threeWay overridden by --no-3way' '
642 '
643
644 test_expect_success 'am can rename a file' '
645 - grep "^rename from" rename.patch &&
645 + test_grep "^rename from" rename.patch &&
646 rm -fr .git/rebase-apply &&
647 git reset --hard &&
648 git checkout lorem^0 &&
@@ -653,7 +653,7 @@ test_expect_success 'am can rename a file' '
653 '
654
655 test_expect_success 'am -3 can rename a file' '
656 - grep "^rename from" rename.patch &&
656 + test_grep "^rename from" rename.patch &&
657 rm -fr .git/rebase-apply &&
658 git reset --hard &&
659 git checkout lorem^0 &&
@@ -664,7 +664,7 @@ test_expect_success 'am -3 can rename a file' '
664 '
665
666 test_expect_success 'am -3 can rename a file after falling back to 3-way merge' '
667 - grep "^rename from" rename-add.patch &&
667 + test_grep "^rename from" rename-add.patch &&
668 rm -fr .git/rebase-apply &&
669 git reset --hard &&
670 git checkout lorem^0 &&
@@ -884,7 +884,7 @@ test_expect_success 'am --ignore-date' '
884 git am --ignore-date patch1 &&
885 git cat-file commit HEAD | sed -e "/^\$/q" >head1 &&
886 sed -ne "/^author /s/.*> //p" head1 >at &&
887 - grep "+0000" at
887 + test_grep "+0000" at
888 '
889
890 test_expect_success 'am into an unborn branch' '
@@ -1066,7 +1066,7 @@ test_expect_success 'am --patch-format=mboxrd handles mboxrd' '
1066 INPUT_END
1067 git commit -F msg &&
1068 git -c format.mboxrd format-patch --stdout -1 >mboxrd1 &&
1069 - grep "^>From could trip up a loose mbox parser" mboxrd1 &&
1069 + test_grep "^>From could trip up a loose mbox parser" mboxrd1 &&
1070 git checkout -f first &&
1071 git am --patch-format=mboxrd mboxrd1 &&
1072 git cat-file commit HEAD | tail -n4 >out &&
@@ -1144,21 +1144,21 @@ test_expect_success 'am and .gitattibutes' '
1144 git format-patch --stdout main..HEAD >patches &&
1145 git reset --hard main &&
1146 git am patches &&
1147 - grep "smudged" a.txt &&
1147 + test_grep "smudged" a.txt &&
1148
1149 git checkout removal &&
1150 git reset --hard &&
1151 git format-patch --stdout main..HEAD >patches &&
1152 git reset --hard main &&
1153 git am patches &&
1154 - grep "clean" a.txt &&
1154 + test_grep "clean" a.txt &&
1155
1156 git checkout conflict &&
1157 git reset --hard &&
1158 git format-patch --stdout main..HEAD >patches &&
1159 git reset --hard fourth &&
1160 test_must_fail git am -3 patches &&
1161 - grep "<<<<<<<<<<" a.txt
1161 + test_grep "<<<<<<<<<<" a.txt
1162 )
1163 '
1164
@@ -1196,13 +1196,13 @@ test_expect_success 'invalid when passing the --empty option alone' '
1196 test_expect_success 'a message without a patch is an error (default)' '
1197 test_when_finished "git am --abort || :" &&
1198 test_must_fail git am empty-commit.patch >err &&
1199 - grep "Patch is empty" err
1199 + test_grep "Patch is empty" err
1200 '
1201
1202 test_expect_success 'a message without a patch is an error where an explicit "--empty=stop" is given' '
1203 test_when_finished "git am --abort || :" &&
1204 test_must_fail git am --empty=stop empty-commit.patch >err &&
1205 - grep "Patch is empty." err
1205 + test_grep "Patch is empty." err
1206 '
1207
1208 test_expect_success 'a message without a patch will be skipped when "--empty=drop" is given' '
@@ -1210,7 +1210,7 @@ test_expect_success 'a message without a patch will be skipped when "--empty=dro
1210 git rev-parse empty-commit^ >expected &&
1211 git rev-parse HEAD >actual &&
1212 test_cmp expected actual &&
1213 - grep "Skipping: empty commit" output
1213 + test_grep "Skipping: empty commit" output
1214 '
1215
1216 test_expect_success 'record as an empty commit when meeting e-mail message that lacks a patch' '
@@ -1218,15 +1218,15 @@ test_expect_success 'record as an empty commit when meeting e-mail message that
1218 test_path_is_missing .git/rebase-apply &&
1219 git show empty-commit --format="%B" >expected &&
1220 git show HEAD --format="%B" >actual &&
1221 - grep -f actual expected &&
1222 - grep "Creating an empty commit: empty commit" output
1221 + test_grep -f actual expected &&
1222 + test_grep "Creating an empty commit: empty commit" output
1223 '
1224
1225 test_expect_success 'skip an empty patch in the middle of an am session' '
1226 git checkout empty-commit^ &&
1227 test_must_fail git am empty-commit.patch >out 2>err &&
1228 - grep "Patch is empty." out &&
1229 - grep "To record the empty patch as an empty commit, run \"git am --allow-empty\"." err &&
1228 + test_grep "Patch is empty." out &&
1229 + test_grep "To record the empty patch as an empty commit, run \"git am --allow-empty\"." err &&
1230 git am --skip &&
1231 test_path_is_missing .git/rebase-apply &&
1232 git rev-parse empty-commit^ >expected &&
@@ -1237,14 +1237,14 @@ test_expect_success 'skip an empty patch in the middle of an am session' '
1237 test_expect_success 'record an empty patch as an empty commit in the middle of an am session' '
1238 git checkout empty-commit^ &&
1239 test_must_fail git am empty-commit.patch >out 2>err &&
1240 - grep "Patch is empty." out &&
1241 - grep "To record the empty patch as an empty commit, run \"git am --allow-empty\"." err &&
1240 + test_grep "Patch is empty." out &&
1241 + test_grep "To record the empty patch as an empty commit, run \"git am --allow-empty\"." err &&
1242 git am --allow-empty >output &&
1243 - grep "No changes - recorded it as an empty commit." output &&
1243 + test_grep "No changes - recorded it as an empty commit." output &&
1244 test_path_is_missing .git/rebase-apply &&
1245 git show empty-commit --format="%B" >expected &&
1246 git show HEAD --format="%B" >actual &&
1247 - grep -f actual expected
1247 + test_grep -f actual expected
1248 '
1249
1250 test_expect_success 'create an non-empty commit when the index IS changed though "--allow-empty" is given' '
@@ -1255,7 +1255,7 @@ test_expect_success 'create an non-empty commit when the index IS changed though
1255 git am --allow-empty &&
1256 git show empty-commit --format="%B" >expected &&
1257 git show HEAD --format="%B" >actual &&
1258 - grep -f actual expected &&
1258 + test_grep -f actual expected &&
1259 git diff HEAD^..HEAD --name-only
1260 '
1261
@@ -1264,7 +1264,7 @@ test_expect_success 'cannot create empty commits when there is a clean index due
1264 git rev-parse HEAD >expected &&
1265 test_must_fail git am seq.patch &&
1266 test_must_fail git am --allow-empty >err &&
1267 - ! grep "To record the empty patch as an empty commit, run \"git am --allow-empty\"." err &&
1267 + test_grep ! "To record the empty patch as an empty commit, run \"git am --allow-empty\"." err &&
1268 git rev-parse HEAD >actual &&
1269 test_cmp actual expected
1270 '
@@ -1274,7 +1274,7 @@ test_expect_success 'cannot create empty commits when there is unmerged index du
1274 git rev-parse HEAD >expected &&
1275 test_must_fail git am -3 seq.patch &&
1276 test_must_fail git am --allow-empty >err &&
1277 - ! grep "To record the empty patch as an empty commit, run \"git am --allow-empty\"." err &&
1277 + test_grep ! "To record the empty patch as an empty commit, run \"git am --allow-empty\"." err &&
1278 git rev-parse HEAD >actual &&
1279 test_cmp actual expected
1280 '
t/t4200-rerere.sh
+3 -3
@@ -83,7 +83,7 @@ test_expect_success 'activate rerere, old style (conflicting merge)' '
83
84 sha1=$(sed "s/ .*//" .git/MERGE_RR) &&
85 rr=.git/rr-cache/$sha1 &&
86 - grep "^=======\$" $rr/preimage &&
86 + test_grep "^=======\$" $rr/preimage &&
87 test_path_is_missing $rr/postimage &&
88 test_path_is_missing $rr/thisimage
89 '
@@ -96,7 +96,7 @@ test_expect_success 'rerere.enabled works, too' '
96
97 sha1=$(sed "s/ .*//" .git/MERGE_RR) &&
98 rr=.git/rr-cache/$sha1 &&
99 - grep ^=======$ $rr/preimage
99 + test_grep ^=======$ $rr/preimage
100 '
101
102 test_expect_success 'set up rr-cache' '
@@ -177,7 +177,7 @@ test_expect_success 'first postimage wins' '
177
178 test_must_fail git merge first &&
179 # rerere kicked in
180 - ! grep "^=======\$" a1 &&
180 + test_grep ! "^=======\$" a1 &&
181 test_cmp expect a1
182 '
183
t/t4201-shortlog.sh
+1 -1
@@ -267,7 +267,7 @@ test_expect_success 'shortlog --group=<format> DWIM' '
267
268 test_expect_success 'shortlog bogus --group' '
269 test_must_fail git shortlog --group=bogus HEAD 2>err &&
270 - grep "unknown group type" err
270 + test_grep "unknown group type" err
271 '
272
273 test_expect_success 'trailer idents are split' '
t/t4202-log.sh
+42 -42
@@ -668,12 +668,12 @@ test_expect_success 'log --graph with merge with log.graphColors' '
668
669 test_expect_success 'log --raw --graph -m with merge' '
670 git log --raw --graph --oneline -m main | head -n 500 >actual &&
671 - grep "initial" actual
671 + test_grep "initial" actual
672 '
673
674 test_expect_success 'diff-tree --graph' '
675 git diff-tree --graph main^ | head -n 500 >actual &&
676 - grep "one" actual
676 + test_grep "one" actual
677 '
678
679 cat > expect <<\EOF
@@ -1082,13 +1082,13 @@ test_expect_success 'decorate-refs and simplify-by-decoration without output' '
1082 test_expect_success 'decorate-refs-exclude HEAD' '
1083 git log --decorate=full --oneline \
1084 --decorate-refs-exclude="HEAD" >actual &&
1085 - ! grep HEAD actual
1085 + test_grep ! HEAD actual
1086 '
1087
1088 test_expect_success 'decorate-refs focus from default' '
1089 git log --decorate=full --oneline \
1090 --decorate-refs="refs/heads" >actual &&
1091 - ! grep HEAD actual
1091 + test_grep ! HEAD actual
1092 '
1093
1094 test_expect_success '--clear-decorations overrides defaults' '
@@ -2055,45 +2055,45 @@ test_expect_success GPGSSH 'log ssh key fingerprint' '
2055
2056 test_expect_success GPG 'log --graph --show-signature' '
2057 git log --graph --show-signature -n1 signed >actual &&
2058 - grep "^| gpg: Signature made" actual &&
2059 - grep "^| gpg: Good signature" actual
2058 + test_grep "^| gpg: Signature made" actual &&
2059 + test_grep "^| gpg: Good signature" actual
2060 '
2061
2062 test_expect_success GPGSM 'log --graph --show-signature x509' '
2063 git log --graph --show-signature -n1 signed-x509 >actual &&
2064 - grep "^| gpgsm: Signature made" actual &&
2065 - grep "^| gpgsm: Good signature" actual
2064 + test_grep "^| gpgsm: Signature made" actual &&
2065 + test_grep "^| gpgsm: Good signature" actual
2066 '
2067
2068 test_expect_success GPGSSH 'log --graph --show-signature ssh' '
2069 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
2070 git log --graph --show-signature -n1 signed-ssh >actual &&
2071 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
2071 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
2072 '
2073
2074 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure on expired signature key' '
2075 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
2076 git log --graph --show-signature -n1 expired-signed >actual &&
2077 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
2077 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
2078 '
2079
2080 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure on not yet valid signature key' '
2081 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
2082 git log --graph --show-signature -n1 notyetvalid-signed >actual &&
2083 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
2083 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
2084 '
2085
2086 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log show success with commit date and key validity matching' '
2087 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
2088 git log --graph --show-signature -n1 timeboxedvalid-signed >actual &&
2089 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
2090 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual
2089 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
2090 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual
2091 '
2092
2093 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure with commit date outside of key validity' '
2094 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
2095 git log --graph --show-signature -n1 timeboxedinvalid-signed >actual &&
2096 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
2096 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
2097 '
2098
2099 test_expect_success GPG 'log --graph --show-signature for merged tag' '
@@ -2110,9 +2110,9 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
2110 git checkout plain &&
2111 git merge --no-ff -m msg signed_tag &&
2112 git log --graph --show-signature -n1 plain >actual &&
2113 - grep "^|\\\ merged tag" actual &&
2114 - grep "^| | gpg: Signature made" actual &&
2115 - grep "^| | gpg: Good signature" actual
2113 + test_grep "^|\\\ merged tag" actual &&
2114 + test_grep "^| | gpg: Signature made" actual &&
2115 + test_grep "^| | gpg: Good signature" actual
2116 '
2117
2118 test_expect_success GPG 'log --graph --show-signature for merged tag in shallow clone' '
@@ -2132,7 +2132,7 @@ test_expect_success GPG 'log --graph --show-signature for merged tag in shallow
2132 git clone --depth 1 --no-local . shallow &&
2133 test_when_finished "rm -rf shallow" &&
2134 git -C shallow log --graph --show-signature -n1 plain-shallow >actual &&
2135 - grep "tag signed_tag_shallow names a non-parent $hash" actual
2135 + test_grep "tag signed_tag_shallow names a non-parent $hash" actual
2136 '
2137
2138 test_expect_success GPG 'log --graph --show-signature for merged tag with missing key' '
@@ -2149,9 +2149,9 @@ test_expect_success GPG 'log --graph --show-signature for merged tag with missin
2149 git checkout plain-nokey &&
2150 git merge --no-ff -m msg signed_tag_nokey &&
2151 GNUPGHOME=. git log --graph --show-signature -n1 plain-nokey >actual &&
2152 - grep "^|\\\ merged tag" actual &&
2153 - grep "^| | gpg: Signature made" actual &&
2154 - grep -E "^| | gpg: Can'"'"'t check signature: (public key not found|No public key)" actual
2152 + test_grep "^|\\\ merged tag" actual &&
2153 + test_grep "^| | gpg: Signature made" actual &&
2154 + test_grep -E "^| | gpg: Can'"'"'t check signature: (public key not found|No public key)" actual
2155 '
2156
2157 test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' '
@@ -2171,9 +2171,9 @@ test_expect_success GPG 'log --graph --show-signature for merged tag with bad si
2171 git checkout plain-bad &&
2172 git merge --no-ff -m msg "$(cat forged.tag)" &&
2173 git log --graph --show-signature -n1 plain-bad >actual &&
2174 - grep "^|\\\ merged tag" actual &&
2175 - grep "^| | gpg: Signature made" actual &&
2176 - grep "^| | gpg: BAD signature from" actual
2174 + test_grep "^|\\\ merged tag" actual &&
2175 + test_grep "^| | gpg: Signature made" actual &&
2176 + test_grep "^| | gpg: BAD signature from" actual
2177 '
2178
2179 test_expect_success GPG 'log --show-signature for merged tag with GPG failure' '
@@ -2192,9 +2192,9 @@ test_expect_success GPG 'log --show-signature for merged tag with GPG failure' '
2192 if ! test_have_prereq VALGRIND
2193 then
2194 TMPDIR="$(pwd)/bogus" git log --show-signature -n1 plain-fail >actual &&
2195 - grep "^merged tag" actual &&
2196 - grep "^No signature" actual &&
2197 - ! grep "^gpg: Signature made" actual
2195 + test_grep "^merged tag" actual &&
2196 + test_grep "^No signature" actual &&
2197 + test_grep ! "^gpg: Signature made" actual
2198 fi
2199 '
2200
@@ -2214,9 +2214,9 @@ test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
2214 git checkout plain-x509 &&
2215 git merge --no-ff -m msg signed_tag_x509 &&
2216 git log --graph --show-signature -n1 plain-x509 >actual &&
2217 - grep "^|\\\ merged tag" actual &&
2218 - grep "^| | gpgsm: Signature made" actual &&
2219 - grep "^| | gpgsm: Good signature" actual
2217 + test_grep "^|\\\ merged tag" actual &&
2218 + test_grep "^| | gpgsm: Signature made" actual &&
2219 + test_grep "^| | gpgsm: Good signature" actual
2220 '
2221
2222 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 missing key' '
@@ -2235,8 +2235,8 @@ test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 miss
2235 git checkout plain-x509-nokey &&
2236 git merge --no-ff -m msg signed_tag_x509_nokey &&
2237 GNUPGHOME=. git log --graph --show-signature -n1 plain-x509-nokey >actual &&
2238 - grep "^|\\\ merged tag" actual &&
2239 - grep -e "^| | gpgsm: certificate not found" \
2238 + test_grep "^|\\\ merged tag" actual &&
2239 + test_grep -e "^| | gpgsm: certificate not found" \
2240 -e "^| | gpgsm: failed to find the certificate: Not found" actual
2241 '
2242
@@ -2259,35 +2259,35 @@ test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 bad
2259 git checkout plain-x509-bad &&
2260 git merge --no-ff -m msg "$(cat forged.tag)" &&
2261 git log --graph --show-signature -n1 plain-x509-bad >actual &&
2262 - grep "^|\\\ merged tag" actual &&
2263 - grep "^| | gpgsm: Signature made" actual &&
2264 - grep "^| | gpgsm: invalid signature" actual
2262 + test_grep "^|\\\ merged tag" actual &&
2263 + test_grep "^| | gpgsm: Signature made" actual &&
2264 + test_grep "^| | gpgsm: invalid signature" actual
2265 '
2266
2267
2268 test_expect_success GPG '--no-show-signature overrides --show-signature' '
2269 git log -1 --show-signature --no-show-signature signed >actual &&
2270 - ! grep "^gpg:" actual
2270 + test_grep ! "^gpg:" actual
2271 '
2272
2273 test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
2274 test_config log.showsignature true &&
2275 git log -1 signed >actual &&
2276 - grep "gpg: Signature made" actual &&
2277 - grep "gpg: Good signature" actual
2276 + test_grep "gpg: Signature made" actual &&
2277 + test_grep "gpg: Good signature" actual
2278 '
2279
2280 test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
2281 test_config log.showsignature true &&
2282 git log -1 --no-show-signature signed >actual &&
2283 - ! grep "^gpg:" actual
2283 + test_grep ! "^gpg:" actual
2284 '
2285
2286 test_expect_success GPG '--show-signature overrides log.showsignature=false' '
2287 test_config log.showsignature false &&
2288 git log -1 --show-signature signed >actual &&
2289 - grep "gpg: Signature made" actual &&
2290 - grep "gpg: Good signature" actual
2289 + test_grep "gpg: Signature made" actual &&
2290 + test_grep "gpg: Good signature" actual
2291 '
2292
2293 test_expect_success 'log --graph --no-walk is forbidden' '
@@ -2383,7 +2383,7 @@ test_expect_success 'log --decorate does not include things outside filter' '
2383 git log --decorate=full --oneline >actual &&
2384
2385 # None of the refs are visible:
2386 - ! grep /fake actual
2386 + test_grep ! /fake actual
2387 '
2388
2389 test_expect_success 'log --end-of-options' '
t/t4204-patch-id.sh
+1 -1
@@ -44,7 +44,7 @@ test_expect_success 'setup' '
44 test_expect_success 'patch-id output is well-formed' '
45 git log -p -1 >log.output &&
46 git patch-id <log.output >output &&
47 - grep "^$OID_REGEX $(git rev-parse HEAD)$" output
47 + test_grep "^$OID_REGEX $(git rev-parse HEAD)$" output
48 '
49
50 #calculate patch id. Make sure output is not empty.
t/t4205-log-pretty-formats.sh
+1 -1
@@ -535,7 +535,7 @@ test_expect_success 'strbuf_utf8_replace() not producing NUL' '
535 git log --color --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)%C(auto)%d" |
536 test_decode_color |
537 nul_to_q >actual &&
538 - ! grep Q actual
538 + test_grep ! Q actual
539 '
540
541 # --date=[XXX] and corresponding %a[X] %c[X] format equivalency
t/t4209-log-pickaxe.sh
+5 -5
@@ -64,21 +64,21 @@ test_expect_success 'usage' '
64 test_grep "switch.*requires a value" err &&
65
66 test_expect_code 128 git log -Gregex -Sstring 2>err &&
67 - grep "cannot be used together" err &&
67 + test_grep "cannot be used together" err &&
68
69 test_expect_code 128 git log -Gregex --find-object=HEAD 2>err &&
70 - grep "cannot be used together" err &&
70 + test_grep "cannot be used together" err &&
71
72 test_expect_code 128 git log -Sstring --find-object=HEAD 2>err &&
73 - grep "cannot be used together" err &&
73 + test_grep "cannot be used together" err &&
74
75 test_expect_code 128 git log --pickaxe-all --find-object=HEAD 2>err &&
76 - grep "cannot be used together" err
76 + test_grep "cannot be used together" err
77 '
78
79 test_expect_success 'usage: --pickaxe-regex' '
80 test_expect_code 128 git log -Gregex --pickaxe-regex 2>err &&
81 - grep "cannot be used together" err
81 + test_grep "cannot be used together" err
82 '
83
84 test_expect_success 'usage: --no-pickaxe-regex' '
t/t4211-line-log.sh
+36 -36
@@ -393,14 +393,14 @@ test_expect_success '-L diff output includes index and new file mode' '
393 git log -L:func2:file.c --format= >actual &&
394
395 # Output should contain index headers (not present in old code path)
396 - grep "^index $head_blob_old\.\.$head_blob_new 100644" actual &&
396 + test_grep "^index $head_blob_old\.\.$head_blob_new 100644" actual &&
397
398 # Root commit should show new file mode and null index
399 - grep "^new file mode 100644" actual &&
400 - grep "^index $null_blob\.\.$root_blob$" actual &&
399 + test_grep "^new file mode 100644" actual &&
400 + test_grep "^index $null_blob\.\.$root_blob$" actual &&
401
402 # Hunk headers should include funcname context
403 - grep "^@@ .* @@ int func1()" actual
403 + test_grep "^@@ .* @@ int func1()" actual
404 '
405
406 test_expect_success '-L with --word-diff' '
@@ -431,15 +431,15 @@ test_expect_success '-L with --word-diff' '
431
432 test_expect_success '-L with --no-prefix' '
433 git log -L:func2:file.c --no-prefix --format= >actual &&
434 - grep "^diff --git file.c file.c" actual &&
435 - grep "^--- file.c" actual &&
436 - ! grep "^--- a/" actual
434 + test_grep "^diff --git file.c file.c" actual &&
435 + test_grep "^--- file.c" actual &&
436 + test_grep ! "^--- a/" actual
437 '
438
439 test_expect_success '-L with --full-index' '
440 git log -L:func2:file.c --full-index --format= >actual &&
441 - grep "^index $head_blob_old_full\.\.$head_blob_new_full 100644" actual &&
442 - grep "^index $null_blob_full\.\.$root_blob_full$" actual
441 + test_grep "^index $head_blob_old_full\.\.$head_blob_new_full 100644" actual &&
442 + test_grep "^index $null_blob_full\.\.$root_blob_full$" actual
443 '
444
445 test_expect_success 'setup -L with whitespace change' '
@@ -548,29 +548,29 @@ test_expect_success '-L with --word-diff-regex' '
548 git log -L:func2:file.c --word-diff \
549 --word-diff-regex="[a-zA-Z0-9_]+" --format= >actual &&
550 # Word-diff markers must be present
551 - grep "{+" actual &&
552 - grep "+}" actual &&
551 + test_grep "{+" actual &&
552 + test_grep "+}" actual &&
553 # No line-level +/- markers (word-diff replaces them);
554 # exclude --- header lines from the check
555 - ! grep "^+[^+]" actual &&
556 - ! grep "^-[^-]" actual
555 + test_grep ! "^+[^+]" actual &&
556 + test_grep ! "^-[^-]" actual
557 '
558
559 test_expect_success '-L with --src-prefix and --dst-prefix' '
560 git checkout parent-oids &&
561 git log -L:func2:file.c --src-prefix=old/ --dst-prefix=new/ \
562 --format= >actual &&
563 - grep "^diff --git old/file.c new/file.c" actual &&
564 - grep "^--- old/file.c" actual &&
565 - grep "^+++ new/file.c" actual &&
566 - ! grep "^--- a/" actual
563 + test_grep "^diff --git old/file.c new/file.c" actual &&
564 + test_grep "^--- old/file.c" actual &&
565 + test_grep "^+++ new/file.c" actual &&
566 + test_grep ! "^--- a/" actual
567 '
568
569 test_expect_success '-L with --abbrev' '
570 git checkout parent-oids &&
571 git log -L:func2:file.c --abbrev=4 --format= -1 >actual &&
572 # 4-char abbreviated hashes on index line
573 - grep "^index [0-9a-f]\{4\}\.\.[0-9a-f]\{4\}" actual
573 + test_grep "^index [0-9a-f]\{4\}\.\.[0-9a-f]\{4\}" actual
574 '
575
576 test_expect_success '-L with -b suppresses whitespace-only diff' '
@@ -586,24 +586,24 @@ test_expect_success '-L with --output-indicator-*' '
586 git log -L:func2:file.c --output-indicator-new=">" \
587 --output-indicator-old="<" --output-indicator-context="|" \
588 --format= -1 >actual &&
589 - grep "^>" actual &&
590 - grep "^<" actual &&
591 - grep "^|" actual &&
589 + test_grep "^>" actual &&
590 + test_grep "^<" actual &&
591 + test_grep "^|" actual &&
592 # No standard +/-/space content markers; exclude ---/+++ headers
593 - ! grep "^+[^+]" actual &&
594 - ! grep "^-[^-]" actual &&
595 - ! grep "^ " actual
593 + test_grep ! "^+[^+]" actual &&
594 + test_grep ! "^-[^-]" actual &&
595 + test_grep ! "^ " actual
596 '
597
598 test_expect_success '-L with -R reverses diff' '
599 git checkout parent-oids &&
600 git log -L:func2:file.c -R --format= -1 >actual &&
601 - grep "^diff --git b/file.c a/file.c" actual &&
602 - grep "^--- b/file.c" actual &&
603 - grep "^+++ a/file.c" actual &&
601 + test_grep "^diff --git b/file.c a/file.c" actual &&
602 + test_grep "^--- b/file.c" actual &&
603 + test_grep "^+++ a/file.c" actual &&
604 # The modification added "F2 + 2", so reversed it is removed
605 - grep "^-.*F2 + 2" actual &&
606 - grep "^+.*return F2;" actual
605 + test_grep "^-.*F2 + 2" actual &&
606 + test_grep "^+.*return F2;" actual
607 '
608
609 test_expect_success 'setup for color-moved test' '
@@ -629,8 +629,8 @@ test_expect_success '-L with --color-moved' '
629 --color=always --format= -1 >actual.raw &&
630 test_decode_color <actual.raw >actual &&
631 # Old moved lines: bold magenta; new moved lines: bold cyan
632 - grep "BOLD;MAGENTA" actual &&
633 - grep "BOLD;CYAN" actual
632 + test_grep "BOLD;MAGENTA" actual &&
633 + test_grep "BOLD;CYAN" actual
634 '
635
636 test_expect_success 'setup for no-newline-at-eof tests' '
@@ -650,14 +650,14 @@ test_expect_success 'setup for no-newline-at-eof tests' '
650 # newline, the "\ No newline at end of file" marker should appear.
651 test_expect_success '-L no-newline-at-eof appears in tracked range' '
652 git log -L:bot:noeol.c --format= -1 HEAD~1 >actual &&
653 - grep "No newline at end of file" actual
653 + test_grep "No newline at end of file" actual
654 '
655
656 # When tracking a function that ends before the no-newline content,
657 # the marker should not appear in the output.
658 test_expect_success '-L no-newline-at-eof suppressed outside range' '
659 git log -L:top:noeol.c --format= >actual &&
660 - ! grep "No newline at end of file" actual
660 + test_grep ! "No newline at end of file" actual
661 '
662
663 # When a commit removes a no-newline last line and replaces it with
@@ -665,7 +665,7 @@ test_expect_success '-L no-newline-at-eof suppressed outside range' '
665 # old side of the diff).
666 test_expect_success '-L no-newline-at-eof marker with deleted line' '
667 git log -L:bot:noeol.c --format= -1 >actual &&
668 - grep "No newline at end of file" actual
668 + test_grep "No newline at end of file" actual
669 '
670
671 test_expect_success 'setup for range boundary deletion test' '
@@ -725,7 +725,7 @@ test_expect_success '-L with -S filters to string-count changes' '
725 # combined with the -L range walk, this selects commits that
726 # both touch func2 and change the count of "F2 + 2" in the file.
727 test $(grep -c "^diff --git" actual) = 1 &&
728 - grep "F2 + 2" actual
728 + test_grep "F2 + 2" actual
729 '
730
731 test_expect_success '-L with -G filters to diff-text matches' '
@@ -735,7 +735,7 @@ test_expect_success '-L with -G filters to diff-text matches' '
735 # combined with -L, this selects commits that both touch func2
736 # and have "F2 + 2" in their diff.
737 test $(grep -c "^diff --git" actual) = 1 &&
738 - grep "F2 + 2" actual
738 + test_grep "F2 + 2" actual
739 '
740
741 test_expect_success '-L with --diff-filter=M excludes root commit' '
t/t4216-log-bloom.sh
+9 -9
@@ -224,10 +224,10 @@ test_expect_success 'persist filter settings' '
224 GIT_TEST_BLOOM_SETTINGS_NUM_HASHES=9 \
225 GIT_TEST_BLOOM_SETTINGS_BITS_PER_ENTRY=15 \
226 git commit-graph write --reachable --changed-paths &&
227 - grep "{\"hash_version\":1,\"num_hashes\":9,\"bits_per_entry\":15,\"max_changed_paths\":512" trace2.txt &&
227 + test_grep "{\"hash_version\":1,\"num_hashes\":9,\"bits_per_entry\":15,\"max_changed_paths\":512" trace2.txt &&
228 GIT_TRACE2_EVENT="$(pwd)/trace2-auto.txt" \
229 git commit-graph write --reachable --changed-paths &&
230 - grep "{\"hash_version\":1,\"num_hashes\":9,\"bits_per_entry\":15,\"max_changed_paths\":512" trace2-auto.txt
230 + test_grep "{\"hash_version\":1,\"num_hashes\":9,\"bits_per_entry\":15,\"max_changed_paths\":512" trace2-auto.txt
231 '
232
233 test_max_changed_paths () {
@@ -494,7 +494,7 @@ test_expect_success 'ensure Bloom filters with incompatible settings are ignored
494 >expect 2>err &&
495 git -C $repo log --oneline --no-decorate -- file >actual 2>err &&
496 test_cmp expect actual &&
497 - grep "disabling Bloom filters for commit-graph layer .$layer." err
497 + test_grep "disabling Bloom filters for commit-graph layer .$layer." err
498 '
499
500 test_expect_success 'merge graph layers with incompatible Bloom settings' '
@@ -503,8 +503,8 @@ test_expect_success 'merge graph layers with incompatible Bloom settings' '
503 >trace2.txt &&
504 GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
505 git -C $repo commit-graph write --reachable --changed-paths 2>err &&
506 - grep "disabling Bloom filters for commit-graph layer .$layer." err &&
507 - grep "{\"hash_version\":1,\"num_hashes\":7,\"bits_per_entry\":10,\"max_changed_paths\":512" trace2.txt &&
506 + test_grep "disabling Bloom filters for commit-graph layer .$layer." err &&
507 + test_grep "{\"hash_version\":1,\"num_hashes\":7,\"bits_per_entry\":10,\"max_changed_paths\":512" trace2.txt &&
508
509 test_path_is_file $repo/$graph &&
510 test_dir_is_empty $repo/$graphdir &&
@@ -516,7 +516,7 @@ test_expect_success 'merge graph layers with incompatible Bloom settings' '
516 git -C $repo log --oneline --no-decorate -- file >actual 2>err &&
517
518 test_cmp expect actual &&
519 - grep "statistics:{\"filter_not_present\":0," trace.perf &&
519 + test_grep "statistics:{\"filter_not_present\":0," trace.perf &&
520 test_must_be_empty err
521 '
522
@@ -554,8 +554,8 @@ test_expect_success 'ensure Bloom filter with incompatible versions are ignored'
554 >trace2.txt &&
555 GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
556 git -C $repo -c commitGraph.changedPathsVersion=2 commit-graph write --reachable --changed-paths 2>err &&
557 - grep "disabling Bloom filters for commit-graph layer .$layer." err &&
558 - grep "{\"hash_version\":2,\"num_hashes\":7,\"bits_per_entry\":10,\"max_changed_paths\":512" trace2.txt
557 + test_grep "disabling Bloom filters for commit-graph layer .$layer." err &&
558 + test_grep "{\"hash_version\":2,\"num_hashes\":7,\"bits_per_entry\":10,\"max_changed_paths\":512" trace2.txt
559 '
560
561 get_first_changed_path_filter () {
@@ -776,7 +776,7 @@ test_expect_success PERL_TEST_HELPERS 'Bloom reader notices too-small data chunk
776 test_expect_success PERL_TEST_HELPERS 'Bloom reader notices out-of-bounds filter offsets' '
777 check_corrupt_graph BIDX 12 FFFFFFFF &&
778 # use grep to avoid depending on exact chunk size
779 - grep "warning: ignoring out-of-range offset (4294967295) for changed-path filter at pos 3 of .git/objects/info/commit-graph" err
779 + test_grep "warning: ignoring out-of-range offset (4294967295) for changed-path filter at pos 3 of .git/objects/info/commit-graph" err
780 '
781
782 test_expect_success PERL_TEST_HELPERS 'Bloom reader notices too-small index chunk' '
t/t4252-am-options.sh
+11 -11
@@ -20,8 +20,8 @@ test_expect_success 'interrupted am --whitespace=fix' '
20 git reset --hard initial &&
21 test_must_fail git am --whitespace=fix "$tm"/am-test-1-? &&
22 git am --skip &&
23 - grep 3 file-1 &&
24 - grep "^Six$" file-2
23 + test_grep 3 file-1 &&
24 + test_grep "^Six$" file-2
25 '
26
27 test_expect_success 'interrupted am -C1' '
@@ -29,8 +29,8 @@ test_expect_success 'interrupted am -C1' '
29 git reset --hard initial &&
30 test_must_fail git am -C1 "$tm"/am-test-2-? &&
31 git am --skip &&
32 - grep 3 file-1 &&
33 - grep "^Three$" file-2
32 + test_grep 3 file-1 &&
33 + test_grep "^Three$" file-2
34 '
35
36 test_expect_success 'interrupted am -p2' '
@@ -38,8 +38,8 @@ test_expect_success 'interrupted am -p2' '
38 git reset --hard initial &&
39 test_must_fail git am -p2 "$tm"/am-test-3-? &&
40 git am --skip &&
41 - grep 3 file-1 &&
42 - grep "^Three$" file-2
41 + test_grep 3 file-1 &&
42 + test_grep "^Three$" file-2
43 '
44
45 test_expect_success 'interrupted am -C1 -p2' '
@@ -47,8 +47,8 @@ test_expect_success 'interrupted am -C1 -p2' '
47 git reset --hard initial &&
48 test_must_fail git am -p2 -C1 "$tm"/am-test-4-? &&
49 git am --skip &&
50 - grep 3 file-1 &&
51 - grep "^Three$" file-2
50 + test_grep 3 file-1 &&
51 + test_grep "^Three$" file-2
52 '
53
54 test_expect_success 'interrupted am --directory="frotz nitfol"' '
@@ -56,7 +56,7 @@ test_expect_success 'interrupted am --directory="frotz nitfol"' '
56 git reset --hard initial &&
57 test_must_fail git am --directory="frotz nitfol" "$tm"/am-test-5-? &&
58 git am --skip &&
59 - grep One "frotz nitfol/file-5"
59 + test_grep One "frotz nitfol/file-5"
60 '
61
62 test_expect_success 'apply to a funny path' '
@@ -71,9 +71,9 @@ test_expect_success 'am --reject' '
71 rm -rf .git/rebase-apply &&
72 git reset --hard initial &&
73 test_must_fail git am --reject "$tm"/am-test-6-1 &&
74 - grep "@@ -1,3 +1,3 @@" file-2.rej &&
74 + test_grep "@@ -1,3 +1,3 @@" file-2.rej &&
75 test_must_fail git diff-files --exit-code --quiet file-2 &&
76 - grep "[-]-reject" .git/rebase-apply/apply-opt
76 + test_grep "[-]-reject" .git/rebase-apply/apply-opt
77 '
78
79 test_done
t/t4254-am-corrupt.sh
+3 -3
@@ -73,16 +73,16 @@ test_expect_success "NUL in commit message's body" '
73 test_when_finished "git am --abort" &&
74 make_mbox_with_nul body >body.patch &&
75 test_must_fail git am body.patch 2>err &&
76 - grep "a NUL byte in commit log message not allowed" err
76 + test_grep "a NUL byte in commit log message not allowed" err
77 '
78
79 test_expect_success "NUL in commit message's header" "
80 test_when_finished 'git am --abort' &&
81 make_mbox_with_nul subject >subject.patch &&
82 test_must_fail git mailinfo msg patch <subject.patch 2>err &&
83 - grep \"a NUL byte in 'Subject' is not allowed\" err &&
83 + test_grep \"a NUL byte in 'Subject' is not allowed\" err &&
84 test_must_fail git am subject.patch 2>err &&
85 - grep \"a NUL byte in 'Subject' is not allowed\" err
85 + test_grep \"a NUL byte in 'Subject' is not allowed\" err
86 "
87
88 test_done
t/t4258-am-quoted-cr.sh
+1 -1
@@ -16,7 +16,7 @@ test_expect_success 'setup' '
16 test_expect_success 'am warn if quoted-cr is found' '
17 git reset --hard one &&
18 test_must_fail git am "$DATA/mbox" 2>err &&
19 - grep "quoted CRLF detected" err
19 + test_grep "quoted CRLF detected" err
20 '
21
22 test_expect_success 'am --quoted-cr=strip' '
t/t4301-merge-tree-write-tree.sh
+9 -9
@@ -88,7 +88,7 @@ test_expect_success 'Clean merge' '
88 # Repeat the previous test, but turn off rename detection
89 test_expect_success 'Failed merge without rename detection' '
90 test_must_fail git -c diff.renames=false merge-tree --write-tree side1 side3 >out &&
91 - grep "CONFLICT (modify/delete): numbers deleted" out
91 + test_grep "CONFLICT (modify/delete): numbers deleted" out
92 '
93
94 test_expect_success '--quiet on conflicted merge' '
@@ -161,13 +161,13 @@ test_expect_success 'Barf on misspelled option, with exit code other than 0 or 1
161 # Mis-spell with single "s" instead of double "s"
162 test_expect_code 129 git merge-tree --write-tree --mesages FOOBAR side1 side2 2>expect &&
163
164 - grep "error: unknown option.*mesages" expect
164 + test_grep "error: unknown option.*mesages" expect
165 '
166
167 test_expect_success 'Barf on too many arguments' '
168 test_expect_code 129 git merge-tree --write-tree side1 side2 invalid 2>expect &&
169
170 - grep "^usage: git merge-tree" expect
170 + test_grep "^usage: git merge-tree" expect
171 '
172
173 anonymize_hash() {
@@ -352,7 +352,7 @@ test_expect_success 'rename/add handling' '
352 #
353 hash=$(tr "\0" "\n" <out | head -n 3 | grep 3.bar | cut -f 2 -d " ") &&
354 git rev-list --objects --all >all_blobs &&
355 - ! grep $hash all_blobs &&
355 + test_grep ! $hash all_blobs &&
356
357 #
358 # Second, check anonymized hash output against expectation
@@ -419,7 +419,7 @@ test_expect_success SYMLINKS 'rename/add, where add is a mode conflict' '
419 #
420 hash=$(tr "\0" "\n" <out | head -n 3 | grep 3.bar | cut -f 2 -d " ") &&
421 git rev-list --objects --all >all_blobs &&
422 - ! grep $hash all_blobs &&
422 + test_grep ! $hash all_blobs &&
423
424 #
425 # Second, check anonymized hash output against expectation
@@ -670,8 +670,8 @@ test_expect_success 'mod6: chains of rename/rename(1to2) and add/add via collidi
670 hash1=$(tr "\0" "\n" <out | head | grep 2.four | cut -f 2 -d " ") &&
671 hash2=$(tr "\0" "\n" <out | head | grep 3.two | cut -f 2 -d " ") &&
672 git rev-list --objects --all >all_blobs &&
673 - ! grep $hash1 all_blobs &&
674 - ! grep $hash2 all_blobs &&
673 + test_grep ! $hash1 all_blobs &&
674 + test_grep ! $hash2 all_blobs &&
675
676 #
677 # Now compare anonymized hash output with expectation
@@ -857,7 +857,7 @@ test_expect_success 'NUL terminated conflicted file "lines"' '
857 test_expect_success 'error out by default for unrelated histories' '
858 test_expect_code 128 git merge-tree --write-tree side1 unrelated 2>error &&
859
860 - grep "refusing to merge unrelated histories" error
860 + test_grep "refusing to merge unrelated histories" error
861 '
862
863 test_expect_success 'can override merge of unrelated histories' '
@@ -924,7 +924,7 @@ test_expect_success '--stdin with both a successful and a conflicted merge' '
924 test_expect_success '--merge-base is incompatible with --stdin' '
925 test_must_fail git merge-tree --merge-base=side1 --stdin 2>expect &&
926
927 - grep "^fatal: .*merge-base.*stdin.* cannot be used together" expect
927 + test_grep "^fatal: .*merge-base.*stdin.* cannot be used together" expect
928 '
929
930 # specify merge-base as parent of branch2
t/t5000-tar-tree.sh
+5 -5
@@ -323,14 +323,14 @@ test_expect_success 'setup tar filters' '
323
324 test_expect_success 'archive --list mentions user filter' '
325 git archive --list >output &&
326 - grep "^tar\.foo\$" output &&
327 - grep "^bar\$" output
326 + test_grep "^tar\.foo\$" output &&
327 + test_grep "^bar\$" output
328 '
329
330 test_expect_success 'archive --list shows only enabled remote filters' '
331 git archive --list --remote=. >output &&
332 - ! grep "^tar\.foo\$" output &&
333 - grep "^bar\$" output
332 + test_grep ! "^tar\.foo\$" output &&
333 + test_grep "^bar\$" output
334 '
335
336 test_expect_success 'invoke tar filter by format' '
@@ -440,7 +440,7 @@ test_expect_success 'catch non-matching pathspec' '
440
441 test_expect_success 'reject paths outside the current directory' '
442 test_must_fail git -C a/bin archive HEAD .. >/dev/null 2>err &&
443 - grep "outside the current directory" err
443 + test_grep "outside the current directory" err
444 '
445
446 test_expect_success 'allow pathspecs that resolve to the current directory' '
t/t5004-archive-corner-cases.sh
+1 -1
@@ -205,7 +205,7 @@ test_expect_success EXPENSIVE,LONG_IS_64BIT,UNZIP,UNZIP_ZIP64_SUPPORT,ZIPINFO \
205
206 "$GIT_UNZIP" -t big.zip &&
207 "$ZIPINFO" big.zip >big.lst &&
208 - grep $size big.lst
208 + test_grep $size big.lst
209 '
210
211 build_tree() {
t/t5100-mailinfo.sh
+1 -1
@@ -265,7 +265,7 @@ test_expect_success 'mailinfo warn CR in base64 encoded email' '
265 check_quoted_cr_mail quoted-cr/0001 &&
266 test_must_be_empty quoted-cr/0001.err &&
267 check_quoted_cr_mail quoted-cr/0002 &&
268 - grep "quoted CRLF detected" quoted-cr/0002.err &&
268 + test_grep "quoted CRLF detected" quoted-cr/0002.err &&
269 check_quoted_cr_mail quoted-cr/0001 --quoted-cr=nowarn &&
270 test_must_be_empty quoted-cr/0001.err &&
271 check_quoted_cr_mail quoted-cr/0002 --quoted-cr=nowarn &&
t/t5150-request-pull.sh
+9 -9
@@ -130,8 +130,8 @@ test_expect_success 'pull request when forgot to push' '
130 test_must_fail git request-pull initial "$downstream_url" \
131 2>../err
132 ) &&
133 - grep "No match for commit .*" err &&
134 - grep "Are you sure you pushed" err
133 + test_grep "No match for commit .*" err &&
134 + test_grep "Are you sure you pushed" err
135
136 '
137
@@ -230,7 +230,7 @@ test_expect_success 'pull request format' '
230 cd local &&
231 git request-pull initial "$downstream_url" full
232 ) >request &&
233 - grep " tags/full\$" request
233 + test_grep " tags/full\$" request
234 '
235
236 test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' '
@@ -260,8 +260,8 @@ test_expect_success 'request-pull quotes regex metacharacters properly' '
260 test_must_fail git request-pull initial "$downstream_url" tags/v2.0 \
261 2>../err
262 ) &&
263 - grep "No match for commit .*" err &&
264 - grep "Are you sure you pushed" err
263 + test_grep "No match for commit .*" err &&
264 + test_grep "Are you sure you pushed" err
265
266 '
267
@@ -277,8 +277,8 @@ test_expect_success 'pull request with mismatched object' '
277 test_must_fail git request-pull initial "$downstream_url" tags/full \
278 2>../err
279 ) &&
280 - grep "points to a different object" err &&
281 - grep "Are you sure you pushed" err
280 + test_grep "points to a different object" err &&
281 + test_grep "Are you sure you pushed" err
282
283 '
284
@@ -295,8 +295,8 @@ test_expect_success 'pull request with stale object' '
295 test_must_fail git request-pull initial "$downstream_url" tags/full \
296 2>../err
297 ) &&
298 - grep "points to a different object" err &&
299 - grep "Are you sure you pushed" err
298 + test_grep "points to a different object" err &&
299 + test_grep "Are you sure you pushed" err
300
301 '
302
t/t5300-pack-object.sh
+11 -11
@@ -548,18 +548,18 @@ test_expect_success !PTHREADS,!FAIL_PREREQS \
548 test_must_fail git index-pack --threads=2 2>err &&
549 grep ^warning: err >warnings &&
550 test_line_count = 1 warnings &&
551 - grep -F "no threads support, ignoring --threads=2" err &&
551 + test_grep -F "no threads support, ignoring --threads=2" err &&
552
553 test_must_fail git -c pack.threads=2 index-pack 2>err &&
554 grep ^warning: err >warnings &&
555 test_line_count = 1 warnings &&
556 - grep -F "no threads support, ignoring pack.threads" err &&
556 + test_grep -F "no threads support, ignoring pack.threads" err &&
557
558 test_must_fail git -c pack.threads=2 index-pack --threads=4 2>err &&
559 grep ^warning: err >warnings &&
560 test_line_count = 2 warnings &&
561 - grep -F "no threads support, ignoring --threads=4" err &&
562 - grep -F "no threads support, ignoring pack.threads" err
561 + test_grep -F "no threads support, ignoring --threads=4" err &&
562 + test_grep -F "no threads support, ignoring pack.threads" err
563 '
564
565 test_expect_success !PTHREADS,!FAIL_PREREQS \
@@ -567,18 +567,18 @@ test_expect_success !PTHREADS,!FAIL_PREREQS \
567 git pack-objects --threads=2 --stdout --all </dev/null >/dev/null 2>err &&
568 grep ^warning: err >warnings &&
569 test_line_count = 1 warnings &&
570 - grep -F "no threads support, ignoring --threads" err &&
570 + test_grep -F "no threads support, ignoring --threads" err &&
571
572 git -c pack.threads=2 pack-objects --stdout --all </dev/null >/dev/null 2>err &&
573 grep ^warning: err >warnings &&
574 test_line_count = 1 warnings &&
575 - grep -F "no threads support, ignoring pack.threads" err &&
575 + test_grep -F "no threads support, ignoring pack.threads" err &&
576
577 git -c pack.threads=2 pack-objects --threads=4 --stdout --all </dev/null >/dev/null 2>err &&
578 grep ^warning: err >warnings &&
579 test_line_count = 2 warnings &&
580 - grep -F "no threads support, ignoring --threads" err &&
581 - grep -F "no threads support, ignoring pack.threads" err
580 + test_grep -F "no threads support, ignoring --threads" err &&
581 + test_grep -F "no threads support, ignoring pack.threads" err
582 '
583
584 test_expect_success 'pack-objects in too-many-packs mode' '
@@ -720,14 +720,14 @@ test_expect_success '--name-hash-version=2 and --write-bitmap-index are incompat
720
721 # --stdout option silently removes --write-bitmap-index
722 git pack-objects --stdout --all --name-hash-version=2 --write-bitmap-index >out 2>err &&
723 - ! test_grep "currently, --write-bitmap-index requires --name-hash-version=1" err
723 + test_grep ! "currently, --write-bitmap-index requires --name-hash-version=1" err
724 '
725
726 test_expect_success '--path-walk pack everything' '
727 git -C server rev-parse HEAD >in &&
728 GIT_PROGRESS_DELAY=0 git -C server pack-objects \
729 --stdout --revs --path-walk --progress <in >out.pack 2>err &&
730 - grep "Compressing objects by path" err &&
730 + test_grep "Compressing objects by path" err &&
731 git -C server index-pack --stdin <out.pack
732 '
733
@@ -738,7 +738,7 @@ test_expect_success '--path-walk thin pack' '
738 EOF
739 GIT_PROGRESS_DELAY=0 git -C server pack-objects \
740 --thin --stdout --revs --path-walk --progress <in >out.pack 2>err &&
741 - grep "Compressing objects by path" err &&
741 + test_grep "Compressing objects by path" err &&
742 git -C server index-pack --fix-thin --stdin <out.pack
743 '
744
t/t5302-pack-index.sh
+3 -3
@@ -270,12 +270,12 @@ EOF
270 thirtyeight=${tag#??} &&
271 rm -f .git/objects/${tag%$thirtyeight}/$thirtyeight &&
272 git index-pack --strict tag-test-${pack1}.pack 2>err &&
273 - grep "^warning:.* expected .tagger. line" err
273 + test_grep "^warning:.* expected .tagger. line" err
274 '
275
276 test_expect_success 'index-pack --fsck-objects also warns upon missing tagger in tag' '
277 git index-pack --fsck-objects tag-test-${pack1}.pack 2>err &&
278 - grep "^warning:.* expected .tagger. line" err
278 + test_grep "^warning:.* expected .tagger. line" err
279 '
280
281 test_expect_success 'index-pack -v --stdin produces progress for both phases' '
@@ -290,7 +290,7 @@ test_expect_success 'too-large packs report the breach' '
290 sz="$(test_file_size pack-$pack.pack)" &&
291 test "$sz" -gt 20 &&
292 test_must_fail git index-pack --max-input-size=20 pack-$pack.pack 2>err &&
293 - grep "maximum allowed size (20 bytes)" err
293 + test_grep "maximum allowed size (20 bytes)" err
294 '
295
296 # git-index-pack(1) uses the default hash algorithm outside of the repository,
t/t5304-prune.sh
+4 -4
@@ -120,7 +120,7 @@ test_expect_success 'prune: prune former HEAD after checking out branch' '
120 git checkout --quiet main &&
121 git reflog expire --all &&
122 git prune -v >prune_actual &&
123 - grep "$head_oid" prune_actual
123 + test_grep "$head_oid" prune_actual
124 '
125
126 test_expect_success 'prune: do not prune heads listed as an argument' '
@@ -214,7 +214,7 @@ test_expect_success 'garbage report in count-objects -v' '
214 >.git/objects/pack/fake2.keep &&
215 >.git/objects/pack/fake3.idx &&
216 git count-objects -v 2>stderr &&
217 - grep "index file .git/objects/pack/fake.idx is too small" stderr &&
217 + test_grep "index file .git/objects/pack/fake.idx is too small" stderr &&
218 grep "^warning:" stderr | sort >actual &&
219 cat >expected <<\EOF &&
220 warning: garbage found: .git/objects/pack/fake.bar
@@ -252,8 +252,8 @@ test_expect_success 'prune .git/shallow' '
252 oid=$(echo hi|git commit-tree HEAD^{tree}) &&
253 echo $oid >.git/shallow &&
254 git prune --dry-run >out &&
255 - grep $oid .git/shallow &&
256 - grep $oid out &&
255 + test_grep $oid .git/shallow &&
256 + test_grep $oid out &&
257 git prune &&
258 test_path_is_missing .git/shallow
259 '
t/t5310-pack-bitmaps.sh
+7 -7
@@ -81,8 +81,8 @@ test_bitmap_cases () {
81 git repack -ad &&
82 ls .git/objects/pack/ | grep bitmap >output &&
83 test_line_count = 1 output &&
84 - grep "\"key\":\"num_selected_commits\",\"value\":\"106\"" trace &&
85 - grep "\"key\":\"num_maximal_commits\",\"value\":\"107\"" trace
84 + test_grep "\"key\":\"num_selected_commits\",\"value\":\"106\"" trace &&
85 + test_grep "\"key\":\"num_maximal_commits\",\"value\":\"107\"" trace
86 '
87
88 basic_bitmap_tests
@@ -532,8 +532,8 @@ test_bitmap_cases () {
532 test_line_count = 2 bitmaps &&
533
534 GIT_TRACE2_EVENT=$(pwd)/trace2.txt git rev-list --use-bitmap-index HEAD &&
535 - grep "opened bitmap" trace2.txt &&
536 - grep "ignoring extra bitmap" trace2.txt
535 + test_grep "opened bitmap" trace2.txt &&
536 + test_grep "ignoring extra bitmap" trace2.txt
537 )
538 '
539
@@ -598,7 +598,7 @@ test_expect_success 'boundary-based traversal is used when requested' '
598 do
599 eval "GIT_TRACE2_EVENT=1 $argv rev-list --objects \
600 --use-bitmap-index second..other 2>perf" &&
601 - grep "\"region_enter\".*\"label\":\"haves/boundary\"" perf ||
601 + test_grep "\"region_enter\".*\"label\":\"haves/boundary\"" perf ||
602 return 1
603 done &&
604
@@ -610,7 +610,7 @@ test_expect_success 'boundary-based traversal is used when requested' '
610 do
611 eval "GIT_TRACE2_EVENT=1 $argv rev-list --objects \
612 --use-bitmap-index second..other 2>perf" &&
613 - grep "\"region_enter\".*\"label\":\"haves/classic\"" perf ||
613 + test_grep "\"region_enter\".*\"label\":\"haves/classic\"" perf ||
614 return 1
615 done
616 '
@@ -632,7 +632,7 @@ test_bitmap_cases "pack.writeBitmapLookupTable"
632 test_expect_success 'verify writing bitmap lookup table when enabled' '
633 GIT_TRACE2_EVENT="$(pwd)/trace2" \
634 git repack -ad &&
635 - grep "\"label\":\"writing_lookup_table\"" trace2
635 + test_grep "\"label\":\"writing_lookup_table\"" trace2
636 '
637
638 test_expect_success 'truncated bitmap fails gracefully (lookup table)' '
t/t5317-pack-objects-filter-objects.sh
+6 -6
@@ -49,7 +49,7 @@ test_expect_success 'verify blob:none packfile has no blobs' '
49 git -C r1 index-pack ../filter.pack &&
50
51 git -C r1 verify-pack -v ../filter.pack >verify_result &&
52 - ! grep blob verify_result
52 + test_grep ! blob verify_result
53 '
54
55 test_expect_success 'verify blob:none packfile without --stdout' '
@@ -57,7 +57,7 @@ test_expect_success 'verify blob:none packfile without --stdout' '
57 HEAD
58 EOF
59 git -C r1 verify-pack -v "mypackname-$(cat packhash).pack" >verify_result &&
60 - ! grep blob verify_result
60 + test_grep ! blob verify_result
61 '
62
63 test_expect_success 'verify normal and blob:none packfiles have same commits/trees' '
@@ -85,7 +85,7 @@ test_expect_success 'get an error for missing tree object' '
85 test_must_fail git -C r5 pack-objects --revs --stdout 2>bad_tree <<-EOF &&
86 HEAD
87 EOF
88 - grep "bad tree object" bad_tree
88 + test_grep "bad tree object" bad_tree
89 '
90
91 test_expect_success 'setup for tests of tree:0' '
@@ -101,7 +101,7 @@ test_expect_success 'verify tree:0 packfile has no blobs or trees' '
101 EOF
102 git -C r1 index-pack ../commitsonly.pack &&
103 git -C r1 verify-pack -v ../commitsonly.pack >objs &&
104 - ! grep -E "tree|blob" objs
104 + test_grep ! -E "tree|blob" objs
105 '
106
107 test_expect_success 'grab tree directly when using tree:0' '
@@ -156,7 +156,7 @@ test_expect_success 'verify blob:limit=500 omits all blobs' '
156 git -C r2 index-pack ../filter.pack &&
157
158 git -C r2 verify-pack -v ../filter.pack >verify_result &&
159 - ! grep blob verify_result
159 + test_grep ! blob verify_result
160 '
161
162 test_expect_success 'verify blob:limit=1000' '
@@ -166,7 +166,7 @@ test_expect_success 'verify blob:limit=1000' '
166 git -C r2 index-pack ../filter.pack &&
167
168 git -C r2 verify-pack -v ../filter.pack >verify_result &&
169 - ! grep blob verify_result
169 + test_grep ! blob verify_result
170 '
171
172 test_expect_success 'verify blob:limit=1001' '
t/t5318-commit-graph.sh
+4 -4
@@ -14,7 +14,7 @@ test_expect_success 'usage' '
14
15 test_expect_success 'usage shown without sub-command' '
16 test_expect_code 129 git commit-graph 2>err &&
17 - grep usage: err
17 + test_grep usage: err
18 '
19
20 test_expect_success 'usage shown with an error on unknown sub-command' '
@@ -679,12 +679,12 @@ test_expect_success 'git fsck (checks commit-graph when config unset)' '
679
680 test_expect_success 'git fsck shows commit-graph output with --progress' '
681 git -C "$TRASH_DIRECTORY/full" fsck --progress 2>err &&
682 - grep "Verifying commits in commit graph" err
682 + test_grep "Verifying commits in commit graph" err
683 '
684
685 test_expect_success 'git fsck suppresses commit-graph output with --no-progress' '
686 git -C "$TRASH_DIRECTORY/full" fsck --no-progress 2>err &&
687 - ! grep "Verifying commits in commit graph" err
687 + test_grep ! "Verifying commits in commit graph" err
688 '
689
690 test_expect_success 'setup non-the_repository tests' '
@@ -962,7 +962,7 @@ test_expect_success 'stale commit cannot be parsed when traversing graph' '
962 git rev-parse HEAD~2 &&
963 # ... but fail when we are paranoid.
964 test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-parse HEAD~2 2>error &&
965 - grep "error: commit $oid exists in commit-graph but not in the object database" error
965 + test_grep "error: commit $oid exists in commit-graph but not in the object database" error
966 )
967 '
968
t/t5319-multi-pack-index.sh
+8 -8
@@ -130,7 +130,7 @@ test_expect_success 'corrupt idx reports errors' '
130 test_copy_bytes 1064 <backup-$idx >$objdir/pack/$idx &&
131
132 git -c core.multiPackIndex=true rev-list --objects --all 2>err &&
133 - grep "index unavailable" err
133 + test_grep "index unavailable" err
134 '
135
136 test_expect_success 'add more objects' '
@@ -326,7 +326,7 @@ test_expect_success 'preferred packs must be non-empty' '
326
327 test_must_fail git multi-pack-index write \
328 --preferred-pack=pack-$empty.pack 2>err &&
329 - grep "with no objects" err
329 + test_grep "with no objects" err
330 )
331 '
332
@@ -548,14 +548,14 @@ test_expect_success 'git-fsck incorrect offset' '
548
549 test_expect_success 'git fsck shows MIDX output with --progress' '
550 git fsck --progress 2>err &&
551 - grep "Verifying OID order in multi-pack-index" err &&
552 - grep "Verifying object offsets" err
551 + test_grep "Verifying OID order in multi-pack-index" err &&
552 + test_grep "Verifying object offsets" err
553 '
554
555 test_expect_success 'git fsck suppresses MIDX output with --no-progress' '
556 git fsck --no-progress 2>err &&
557 - ! grep "Verifying OID order in multi-pack-index" err &&
558 - ! grep "Verifying object offsets" err
557 + test_grep ! "Verifying OID order in multi-pack-index" err &&
558 + test_grep ! "Verifying object offsets" err
559 '
560
561 test_expect_success 'corrupt MIDX is not reused' '
@@ -1175,12 +1175,12 @@ test_expect_success 'load reverse index when missing .idx, .pack' '
1175
1176 test_expect_success 'usage shown without sub-command' '
1177 test_expect_code 129 git multi-pack-index 2>err &&
1178 - ! test_grep "unrecognized subcommand" err
1178 + test_grep ! "unrecognized subcommand" err
1179 '
1180
1181 test_expect_success 'complains when run outside of a repository' '
1182 nongit test_must_fail git multi-pack-index write 2>err &&
1183 - grep "not a git repository" err
1183 + test_grep "not a git repository" err
1184 '
1185
1186 test_expect_success 'repack with delta islands' '
t/t5324-split-commit-graph.sh
+5 -5
@@ -297,7 +297,7 @@ test_expect_success 'verify notices chain slice which is bogus (base)' '
297 echo "garbage" >$base_file &&
298 test_must_fail git commit-graph verify 2>test_err &&
299 grep -v "^+" test_err >err &&
300 - grep "commit-graph file is too small" err
300 + test_grep "commit-graph file is too small" err
301 )
302 '
303
@@ -310,7 +310,7 @@ test_expect_success 'verify notices chain slice which is bogus (tip)' '
310 echo "garbage" >$tip_file &&
311 test_must_fail git commit-graph verify 2>test_err &&
312 grep -v "^+" test_err >err &&
313 - grep "commit-graph file is too small" err
313 + test_grep "commit-graph file is too small" err
314 )
315 '
316
@@ -379,7 +379,7 @@ test_expect_success 'verify notices too-short chain file' '
379 echo "garbage" >$graphdir/commit-graph-chain &&
380 test_must_fail git commit-graph verify 2>test_err &&
381 grep -v "^+" test_err >err &&
382 - grep "commit-graph chain file too small" err
382 + test_grep "commit-graph chain file too small" err
383 )
384 '
385
@@ -410,7 +410,7 @@ test_expect_success PERL_TEST_HELPERS 'reader bounds-checks base-graph chunk' '
410 git -c core.commitGraph=false log >expect.out &&
411 git -c core.commitGraph=true log >out 2>err &&
412 test_cmp expect.out out &&
413 - grep "commit-graph base graphs chunk is too small" err
413 + test_grep "commit-graph base graphs chunk is too small" err
414 )
415 '
416
@@ -421,7 +421,7 @@ test_expect_success 'add octopus merge' '
421 git commit-graph write --reachable --split &&
422 git commit-graph verify --progress 2>err &&
423 test_line_count = 1 err &&
424 - grep "Verifying commits in commit graph: 100% (18/18)" err &&
424 + test_grep "Verifying commits in commit graph: 100% (18/18)" err &&
425 test_grep ! warning err &&
426 test_line_count = 3 $graphdir/commit-graph-chain
427 '
t/t5325-reverse-index.sh
+1 -1
@@ -65,7 +65,7 @@ test_expect_success 'index-pack can verify reverse indexes' '
65
66 test_must_fail git index-pack --rev-index --verify \
67 $packdir/pack-$pack.pack 2>err &&
68 - grep "validation error" err
68 + test_grep "validation error" err
69 '
70
71 test_expect_success 'index-pack infers reverse index name with -o' '
t/t5326-multi-pack-bitmaps.sh
+14 -14
@@ -121,7 +121,7 @@ test_midx_bitmap_cases () {
121 EOF
122
123 test_must_fail git multi-pack-index write --bitmap 2>err &&
124 - grep "doesn.t have full closure" err &&
124 + test_grep "doesn.t have full closure" err &&
125 test_path_is_missing $midx
126 )
127 '
@@ -215,8 +215,8 @@ test_midx_bitmap_cases () {
215 test_path_is_file $midx-$(midx_checksum $objdir).bitmap &&
216
217 test-tool bitmap list-commits | sort >bitmaps &&
218 - grep "$(git rev-parse one)" bitmaps &&
219 - grep "$(git rev-parse two)" bitmaps &&
218 + test_grep "$(git rev-parse one)" bitmaps &&
219 + test_grep "$(git rev-parse two)" bitmaps &&
220
221 rm -fr $midx-$(midx_checksum $objdir).bitmap &&
222 rm -fr $midx &&
@@ -229,8 +229,8 @@ test_midx_bitmap_cases () {
229 test_path_is_file $midx-$(midx_checksum $objdir).bitmap &&
230
231 test-tool bitmap list-commits | sort >bitmaps &&
232 - grep "$(git rev-parse one)" bitmaps &&
233 - ! grep "$(git rev-parse two)" bitmaps
232 + test_grep "$(git rev-parse one)" bitmaps &&
233 + test_grep ! "$(git rev-parse two)" bitmaps
234 )
235 '
236
@@ -258,7 +258,7 @@ test_midx_bitmap_cases () {
258 test_line_count = 1 before &&
259
260 (
261 - grep -vf before commits.raw &&
261 + grep -vf before commits.raw && # lint-ok: data filter
262 # mark missing commits as preferred
263 sed "s/^/+/" before
264 ) >snapshot &&
@@ -321,7 +321,7 @@ test_midx_bitmap_cases () {
321 git multi-pack-index write --bitmap --stdin-packs \
322 <packs 2>err &&
323
324 - grep "bitmap without any objects" err &&
324 + test_grep "bitmap without any objects" err &&
325
326 test_path_is_file $midx &&
327 test_path_is_missing $midx-$(midx_checksum $objdir).bitmap
@@ -344,7 +344,7 @@ test_midx_bitmap_cases () {
344
345 GIT_TEST_MIDX_READ_RIDX=0 \
346 git rev-list --use-bitmap-index HEAD 2>err &&
347 - ! grep "ignoring extra bitmap file" err
347 + test_grep ! "ignoring extra bitmap file" err
348 )
349 '
350 }
@@ -364,7 +364,7 @@ test_expect_success 'multi-pack-index write writes lookup table if enabled' '
364 git repack -ad &&
365 GIT_TRACE2_EVENT="$(pwd)/trace" \
366 git multi-pack-index write --bitmap &&
367 - grep "\"label\":\"writing_lookup_table\"" trace
367 + test_grep "\"label\":\"writing_lookup_table\"" trace
368 )
369 '
370
@@ -432,7 +432,7 @@ test_expect_success 'tagged commits are selected for bitmapping' '
432
433 git rev-parse HEAD >want &&
434 test-tool bitmap list-commits >actual &&
435 - grep $(cat want) actual
435 + test_grep $(cat want) actual
436 )
437 '
438
@@ -488,17 +488,17 @@ test_expect_success 'git fsck correctly identifies good and bad bitmaps' '
488
489 corrupt_file "$packbitmap" &&
490 test_must_fail git fsck 2>err &&
491 - grep "bitmap file '\''$packbitmap'\'' has invalid checksum" err &&
491 + test_grep "bitmap file '\''$packbitmap'\'' has invalid checksum" err &&
492
493 cp "$packbitmap.bak" "$packbitmap" &&
494 corrupt_file "$midxbitmap" &&
495 test_must_fail git fsck 2>err &&
496 - grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err &&
496 + test_grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err &&
497
498 corrupt_file "$packbitmap" &&
499 test_must_fail git fsck 2>err &&
500 - grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err &&
501 - grep "bitmap file '\''$packbitmap'\'' has invalid checksum" err
500 + test_grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err &&
501 + test_grep "bitmap file '\''$packbitmap'\'' has invalid checksum" err
502 '
503
504 test_expect_success 'corrupt MIDX with bitmap causes fallback' '
t/t5328-commit-graph-64bit-time.sh
+1 -1
@@ -80,7 +80,7 @@ test_expect_success PERL_TEST_HELPERS 'reader notices out-of-bounds generation o
80 git commit-graph write --reachable &&
81 corrupt_chunk_file $graph GDO2 clear &&
82 test_must_fail git log 2>err &&
83 - grep "commit-graph overflow generation data is too small" err
83 + test_grep "commit-graph overflow generation data is too small" err
84 '
85
86 test_done
t/t5329-pack-objects-cruft.sh
+4 -4
@@ -468,8 +468,8 @@ test_expect_success 'cruft --local drops unreachable objects' '
468
469 test-tool pack-mtimes "$(basename $(ls $packdir/pack-*.mtimes))" \
470 >objects &&
471 - ! grep $object objects &&
472 - grep $cruft objects
471 + test_grep ! $object objects &&
472 + test_grep $cruft objects
473 )
474 '
475
@@ -515,7 +515,7 @@ test_expect_success 'cruft objects are freshend via loose' '
515
516 test_path_is_missing "$loose" &&
517 test-tool pack-mtimes "$(basename "$(ls $packdir/pack-*.mtimes)")" >cruft &&
518 - grep "$blob" cruft &&
518 + test_grep "$blob" cruft &&
519
520 # write the same object again
521 git hash-object -w -t blob contents &&
@@ -657,7 +657,7 @@ test_expect_success 'multi-valued gc.recentObjectsHook' '
657 # ensure that a dirty exit halts cruft pack generation
658 git config --add gc.recentObjectsHook ./extra-tips.c &&
659 test_must_fail git repack --cruft --cruft-expiration=now -d 2>err &&
660 - grep "unable to enumerate additional recent objects" err &&
660 + test_grep "unable to enumerate additional recent objects" err &&
661
662 # and that the existing cruft pack is left alone
663 test_path_is_file "$mtimes"
t/t5334-incremental-multi-pack-index.sh
+1 -1
@@ -29,7 +29,7 @@ test_expect_success 'convert non-incremental MIDX to incremental' '
29 test_path_is_missing $packdir/multi-pack-index &&
30 test_path_is_file $midx_chain &&
31 test_line_count = 2 $midx_chain &&
32 - grep $old_hash $midx_chain
32 + test_grep $old_hash $midx_chain
33 '
34
35 compare_results_with_midx 'incremental MIDX'
t/t5335-compact-multi-pack-index.sh
+2 -2
@@ -321,8 +321,8 @@ test_expect_success 'MIDX compaction with --no-write-chain-file' '
321 } >$midx_chain &&
322
323 test-tool read-midx $objdir $layer >midx.data &&
324 - grep "^pack-B-.*\.idx" midx.data &&
325 - grep "^pack-C-.*\.idx" midx.data
324 + test_grep "^pack-B-.*\.idx" midx.data &&
325 + test_grep "^pack-C-.*\.idx" midx.data
326
327 )
328 '
t/t5351-unpack-large-objects.sh
+1 -1
@@ -32,7 +32,7 @@ test_expect_success 'set memory limitation to 1MB' '
32 test_expect_success 'unpack-objects failed under memory limitation' '
33 prepare_dest 2m &&
34 test_must_fail git -C dest.git unpack-objects <pack-$PACK.pack 2>err &&
35 - grep "fatal: attempting to allocate" err
35 + test_grep "fatal: attempting to allocate" err
36 '
37
38 test_expect_success 'unpack-objects works with memory limitation in dry-run mode' '
t/t5402-post-merge-hook.sh
+2 -2
@@ -46,7 +46,7 @@ test_expect_success 'post-merge runs as expected ' '
46 '
47
48 test_expect_success 'post-merge from normal merge receives the right argument ' '
49 - grep 0 clone1/.git/post-merge.args
49 + test_grep 0 clone1/.git/post-merge.args
50 '
51
52 test_expect_success 'post-merge from squash merge runs as expected ' '
@@ -55,7 +55,7 @@ test_expect_success 'post-merge from squash merge runs as expected ' '
55 '
56
57 test_expect_success 'post-merge from squash merge receives the right argument ' '
58 - grep 1 clone2/.git/post-merge.args
58 + test_grep 1 clone2/.git/post-merge.args
59 '
60
61 test_done
t/t5403-post-checkout-hook.sh
+1 -1
@@ -100,7 +100,7 @@ test_rebase () {
100 echo untracked >three.t &&
101 test_when_finished "rm three.t" &&
102 test_must_fail git rebase $args HEAD rebase-fast-forward 2>err &&
103 - grep "untracked working tree files would be overwritten by checkout" err &&
103 + test_grep "untracked working tree files would be overwritten by checkout" err &&
104 test_path_is_missing .git/post-checkout.args
105
106 '
t/t5404-tracking-branches.sh
+1 -1
@@ -59,7 +59,7 @@ test_expect_success 'deleted branches have their tracking branches removed' '
59 test_expect_success 'already deleted tracking branches ignored' '
60 git branch -d -r origin/b3 &&
61 git push origin :b3 >output 2>&1 &&
62 - ! grep "^error: " output
62 + test_grep ! "^error: " output
63 '
64
65 test_done
t/t5406-remote-rejects.sh
+1 -1
@@ -19,6 +19,6 @@ test_expect_success 'setup' '
19
20 test_expect_success 'push reports error' 'test_must_fail git push 2>stderr'
21
22 -test_expect_success 'individual ref reports error' 'grep rejected stderr'
22 +test_expect_success 'individual ref reports error' 'test_grep rejected stderr'
23
24 test_done
t/t5407-post-rewrite-hook.sh
+4 -4
@@ -195,19 +195,19 @@ test_expect_success 'git rebase with failed pick' '
195 set_replace_editor todo &&
196 test_must_fail git rebase -i D D 2>err
197 ) &&
198 - grep "would be overwritten" err &&
198 + test_grep "would be overwritten" err &&
199 rm bar &&
200
201 test_must_fail git rebase --continue 2>err &&
202 - grep "would be overwritten" err &&
202 + test_grep "would be overwritten" err &&
203 rm G &&
204
205 test_must_fail git rebase --continue 2>err &&
206 - grep "would be overwritten" err &&
206 + test_grep "would be overwritten" err &&
207 rm H &&
208
209 test_must_fail git rebase --continue 2>err &&
210 - grep "would be overwritten" err &&
210 + test_grep "would be overwritten" err &&
211 rm I &&
212
213 git rebase --continue &&
t/t5409-colorize-remote-messages.sh
+18 -18
@@ -32,70 +32,70 @@ test_expect_success 'setup' '
32 test_expect_success 'keywords' '
33 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/keywords 2>output &&
34 test_decode_color <output >decoded &&
35 - grep "<BOLD;RED>error<RESET>: error" decoded &&
36 - grep "<YELLOW>hint<RESET>:" decoded &&
37 - grep "<BOLD;GREEN>success<RESET>:" decoded &&
38 - grep "<BOLD;GREEN>SUCCESS<RESET>" decoded &&
39 - grep "<BOLD;YELLOW>warning<RESET>:" decoded
35 + test_grep "<BOLD;RED>error<RESET>: error" decoded &&
36 + test_grep "<YELLOW>hint<RESET>:" decoded &&
37 + test_grep "<BOLD;GREEN>success<RESET>:" decoded &&
38 + test_grep "<BOLD;GREEN>SUCCESS<RESET>" decoded &&
39 + test_grep "<BOLD;YELLOW>warning<RESET>:" decoded
40 '
41
42 test_expect_success 'whole words at line start' '
43 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/whole-words 2>output &&
44 test_decode_color <output >decoded &&
45 - grep "<YELLOW>hint<RESET>:" decoded &&
46 - grep "hinting: not highlighted" decoded &&
47 - grep "prefixerror: error" decoded
45 + test_grep "<YELLOW>hint<RESET>:" decoded &&
46 + test_grep "hinting: not highlighted" decoded &&
47 + test_grep "prefixerror: error" decoded
48 '
49
50 test_expect_success 'short line' '
51 git -C child -c color.remote=always push -f origin HEAD:short-line 2>output &&
52 test_decode_color <output >decoded &&
53 - grep "remote: Err" decoded
53 + test_grep "remote: Err" decoded
54 '
55
56 test_expect_success 'case-insensitive' '
57 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/case-insensitive 2>output &&
58 test_decode_color <output >decoded &&
59 - grep "<BOLD;RED>error<RESET>: error" decoded &&
60 - grep "<BOLD;RED>ERROR<RESET>: also highlighted" decoded
59 + test_grep "<BOLD;RED>error<RESET>: error" decoded &&
60 + test_grep "<BOLD;RED>ERROR<RESET>: also highlighted" decoded
61 '
62
63 test_expect_success 'leading space' '
64 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/leading-space 2>output &&
65 test_decode_color <output >decoded &&
66 - grep " <BOLD;RED>error<RESET>: leading space" decoded
66 + test_grep " <BOLD;RED>error<RESET>: leading space" decoded
67 '
68
69 test_expect_success 'spaces only' '
70 git -C child -c color.remote=always push -f origin HEAD:only-space 2>output &&
71 test_decode_color <output >decoded &&
72 - grep "remote: " decoded
72 + test_grep "remote: " decoded
73 '
74
75 test_expect_success 'no coloring for redirected output' '
76 git --git-dir child/.git push -f origin HEAD:refs/heads/redirected-output 2>output &&
77 test_decode_color <output >decoded &&
78 - grep "error: error" decoded
78 + test_grep "error: error" decoded
79 '
80
81 test_expect_success 'push with customized color' '
82 git --git-dir child/.git -c color.remote=always -c color.remote.error=blue push -f origin HEAD:refs/heads/customized-color 2>output &&
83 test_decode_color <output >decoded &&
84 - grep "<BLUE>error<RESET>:" decoded &&
85 - grep "<BOLD;GREEN>success<RESET>:" decoded
84 + test_grep "<BLUE>error<RESET>:" decoded &&
85 + test_grep "<BOLD;GREEN>success<RESET>:" decoded
86 '
87
88
89 test_expect_success 'error in customized color' '
90 git --git-dir child/.git -c color.remote=always -c color.remote.error=i-am-not-a-color push -f origin HEAD:refs/heads/error-customized-color 2>output &&
91 test_decode_color <output >decoded &&
92 - grep "<BOLD;GREEN>success<RESET>:" decoded
92 + test_grep "<BOLD;GREEN>success<RESET>:" decoded
93 '
94
95 test_expect_success 'fallback to color.ui' '
96 git --git-dir child/.git -c color.ui=always push -f origin HEAD:refs/heads/fallback-color-ui 2>output &&
97 test_decode_color <output >decoded &&
98 - grep "<BOLD;RED>error<RESET>: error" decoded
98 + test_grep "<BOLD;RED>error<RESET>: error" decoded
99 '
100
101 test_expect_success 'disallow (color) control sequences in sideband' '
t/t5500-fetch-pack.sh
+19 -19
@@ -135,15 +135,15 @@ test_expect_success 'single given branch clone' '
135 GIT_TRACE2_EVENT="$(pwd)/branch-a/trace2_event" \
136 git clone --single-branch --branch A "file://$(pwd)/." branch-a &&
137 test_must_fail git --git-dir=branch-a/.git rev-parse origin/B &&
138 - grep \"fetch-info\".*\"haves\":0 branch-a/trace2_event &&
139 - grep \"fetch-info\".*\"wants\":1 branch-a/trace2_event
138 + test_grep \"fetch-info\".*\"haves\":0 branch-a/trace2_event &&
139 + test_grep \"fetch-info\".*\"wants\":1 branch-a/trace2_event
140 '
141
142 test_expect_success 'clone shallow depth 1' '
143 GIT_TRACE2_EVENT="$(pwd)/shallow0/trace2_event" \
144 git clone --no-single-branch --depth 1 "file://$(pwd)/." shallow0 &&
145 test "$(git --git-dir=shallow0/.git rev-list --count HEAD)" = 1 &&
146 - grep \"fetch-info\".*\"depth\":1 shallow0/trace2_event
146 + test_grep \"fetch-info\".*\"depth\":1 shallow0/trace2_event
147 '
148
149 test_expect_success 'clone shallow depth 1 with fsck' '
@@ -167,7 +167,7 @@ test_expect_success 'clone shallow object count' '
167 cd shallow &&
168 git count-objects -v
169 ) > count.shallow &&
170 - grep "^in-pack: 12" count.shallow
170 + test_grep "^in-pack: 12" count.shallow
171 '
172
173 test_expect_success 'clone shallow object count (part 2)' '
@@ -230,7 +230,7 @@ test_expect_success 'clone shallow object count' '
230 cd shallow &&
231 git count-objects -v
232 ) > count.shallow &&
233 - grep "^count: 6" count.shallow
233 + test_grep "^count: 6" count.shallow
234 '
235
236 test_expect_success 'add two more (part 2)' '
@@ -243,8 +243,8 @@ test_expect_success 'deepening pull in shallow repo' '
243 cd shallow &&
244 GIT_TRACE2_EVENT="$(pwd)/trace2_event" \
245 git pull --depth 4 .. B &&
246 - grep \"fetch-info\".*\"depth\":4 trace2_event &&
247 - grep \"fetch-info\".*\"shallows\":2 trace2_event
246 + test_grep \"fetch-info\".*\"depth\":4 trace2_event &&
247 + test_grep \"fetch-info\".*\"shallows\":2 trace2_event
248 )
249 '
250
@@ -253,7 +253,7 @@ test_expect_success 'clone shallow object count' '
253 cd shallow &&
254 git count-objects -v
255 ) > count.shallow &&
256 - grep "^count: 12" count.shallow
256 + test_grep "^count: 12" count.shallow
257 '
258
259 test_expect_success 'deepening fetch in shallow repo' '
@@ -268,7 +268,7 @@ test_expect_success 'clone shallow object count' '
268 cd shallow &&
269 git count-objects -v
270 ) > count.shallow &&
271 - grep "^count: 18" count.shallow
271 + test_grep "^count: 18" count.shallow
272 '
273
274 test_expect_success 'pull in shallow repo with missing merge base' '
@@ -298,7 +298,7 @@ test_expect_success 'clone shallow object count' '
298 git prune &&
299 git count-objects -v
300 ) > count.shallow &&
301 - grep "^count: 54" count.shallow
301 + test_grep "^count: 54" count.shallow
302 '
303
304 test_expect_success 'fetch --no-shallow on full repo' '
@@ -319,8 +319,8 @@ test_expect_success 'turn shallow to complete repository' '
319 git fetch --unshallow &&
320 ! test -f .git/shallow &&
321 git fsck --full &&
322 - grep \"fetch-info\".*\"shallows\":2 trace2_event &&
323 - grep \"fetch-info\".*\"depth\":2147483647 trace2_event
322 + test_grep \"fetch-info\".*\"shallows\":2 trace2_event &&
323 + test_grep \"fetch-info\".*\"depth\":2147483647 trace2_event
324 )
325 '
326
@@ -333,7 +333,7 @@ test_expect_success 'clone shallow object count' '
333 cd shallow2 &&
334 git count-objects -v
335 ) > count.shallow2 &&
336 - grep "^in-pack: 3" count.shallow2
336 + test_grep "^in-pack: 3" count.shallow2
337 '
338
339 test_expect_success 'clone shallow with --branch' '
@@ -446,7 +446,7 @@ test_expect_success 'in_vain reset upon ACK' '
446 # and should reset in_vain. This allows negotiation to continue until
447 # the client reports that first_anotherbranch_commit is common.
448 GIT_TRACE2_EVENT="$(pwd)/trace2" git -C myclient fetch --progress origin main 2>log &&
449 - grep \"key\":\"total_rounds\",\"value\":\"6\" trace2 &&
449 + test_grep \"key\":\"total_rounds\",\"value\":\"6\" trace2 &&
450 test_grep "Total 3 " log
451 '
452
@@ -852,7 +852,7 @@ test_expect_success 'fetch shallow since ...' '
852 two
853 EOF
854 test_cmp expected actual &&
855 - grep \"fetch-info\".*\"deepen-since\":true shallow11/trace2_event
855 + test_grep \"fetch-info\".*\"deepen-since\":true shallow11/trace2_event
856 '
857
858 test_expect_success 'clone shallow since selects no commits' '
@@ -935,7 +935,7 @@ test_expect_success 'fetch exclude tag one as revision' '
935 test_when_finished rm -f rev err &&
936 git -C shallow-exclude rev-parse one >rev &&
937 test_must_fail git -C shallow12 fetch --shallow-exclude $(cat rev) origin 2>err &&
938 - grep "deepen-not is not a ref:" err
938 + test_grep "deepen-not is not a ref:" err
939 '
940
941 test_expect_success 'fetching deepen' '
@@ -1059,9 +1059,9 @@ test_expect_success 'filtering by size' '
1059 commit=$(git -C server rev-parse HEAD) &&
1060 blob=$(git hash-object server/one.t) &&
1061 git -C client rev-list --objects --missing=allow-any "$commit" >oids &&
1062 - ! grep "$blob" oids &&
1062 + test_grep ! "$blob" oids &&
1063
1064 - grep \"fetch-info\".*\"filter\":\"blob:limit\" client/trace2_event
1064 + test_grep \"fetch-info\".*\"filter\":\"blob:limit\" client/trace2_event
1065 '
1066
1067 test_expect_success 'filtering by size has no effect if support for it is not advertised' '
@@ -1076,7 +1076,7 @@ test_expect_success 'filtering by size has no effect if support for it is not ad
1076 commit=$(git -C server rev-parse HEAD) &&
1077 blob=$(git hash-object server/one.t) &&
1078 git -C client rev-list --objects --missing=allow-any "$commit" >oids &&
1079 - grep "$blob" oids &&
1079 + test_grep "$blob" oids &&
1080
1081 test_grep "filtering not recognized by server" err
1082 '
t/t5504-fetch-receive-strict.sh
+7 -7
@@ -298,13 +298,13 @@ test_expect_success 'push with receive.fsck.missingEmail=warn' '
298 git --git-dir=dst/.git config \
299 receive.fsck.missingEmail warn &&
300 git push --porcelain dst bogus >act 2>&1 &&
301 - grep "missingEmail" act &&
301 + test_grep "missingEmail" act &&
302 test_grep "skipping unknown msg id.*whatever" act &&
303 git --git-dir=dst/.git branch -D bogus &&
304 git --git-dir=dst/.git config --add \
305 receive.fsck.missingEmail ignore &&
306 git push --porcelain dst bogus >act 2>&1 &&
307 - ! grep "missingEmail" act
307 + test_grep ! "missingEmail" act
308 '
309
310 test_expect_success 'fetch with fetch.fsck.missingEmail=warn' '
@@ -326,7 +326,7 @@ test_expect_success 'fetch with fetch.fsck.missingEmail=warn' '
326 git --git-dir=dst/.git config \
327 fetch.fsck.missingEmail warn &&
328 git --git-dir=dst/.git fetch "file://$(pwd)" $refspec >act 2>&1 &&
329 - grep "missingEmail" act &&
329 + test_grep "missingEmail" act &&
330 test_grep "Skipping unknown msg id.*whatever" act &&
331 rm -rf dst &&
332 git init dst &&
@@ -334,7 +334,7 @@ test_expect_success 'fetch with fetch.fsck.missingEmail=warn' '
334 git --git-dir=dst/.git config \
335 fetch.fsck.missingEmail ignore &&
336 git --git-dir=dst/.git fetch "file://$(pwd)" $refspec >act 2>&1 &&
337 - ! grep "missingEmail" act
337 + test_grep ! "missingEmail" act
338 '
339
340 test_expect_success \
@@ -345,7 +345,7 @@ test_expect_success \
345 git --git-dir=dst/.git config \
346 receive.fsck.unterminatedheader warn &&
347 test_must_fail git push --porcelain dst HEAD >act 2>&1 &&
348 - grep "Cannot demote unterminatedheader" act
348 + test_grep "Cannot demote unterminatedheader" act
349 '
350
351 test_expect_success \
@@ -356,7 +356,7 @@ test_expect_success \
356 git --git-dir=dst/.git config \
357 fetch.fsck.unterminatedheader warn &&
358 test_must_fail git --git-dir=dst/.git fetch "file://$(pwd)" HEAD &&
359 - grep "Cannot demote unterminatedheader" act
359 + test_grep "Cannot demote unterminatedheader" act
360 '
361
362 test_expect_success PERL_TEST_HELPERS 'badFilemode is not a strict error' '
@@ -373,7 +373,7 @@ test_expect_success PERL_TEST_HELPERS 'badFilemode is not a strict error' '
373 git -C dst.git config transfer.fsckObjects true &&
374
375 git -C badmode.git push ../dst.git $tree:refs/tags/tree 2>err &&
376 - grep "$tree: badFilemode" err
376 + test_grep "$tree: badFilemode" err
377 '
378
379 test_done
t/t5505-remote.sh
+10 -10
@@ -91,28 +91,28 @@ test_expect_success 'filters for promisor remotes are listed by git remote -v' '
91 test_when_finished "rm -rf pc" &&
92 git clone --filter=blob:none "file://$(pwd)/srv.bare" pc &&
93 git -C pc remote -v >out &&
94 - grep "srv.bare (fetch) \[blob:none\]" out &&
94 + test_grep "srv.bare (fetch) \[blob:none\]" out &&
95
96 git -C pc config remote.origin.partialCloneFilter object:type=commit &&
97 git -C pc remote -v >out &&
98 - grep "srv.bare (fetch) \[object:type=commit\]" out
98 + test_grep "srv.bare (fetch) \[object:type=commit\]" out
99 '
100
101 test_expect_success 'filters should not be listed for non promisor remotes (remote -v)' '
102 test_when_finished "rm -rf pc" &&
103 git clone one pc &&
104 git -C pc remote -v >out &&
105 - ! grep "(fetch) \[.*\]" out
105 + test_grep ! "(fetch) \[.*\]" out
106 '
107
108 test_expect_success 'filters are listed by git remote -v only' '
109 test_when_finished "rm -rf pc" &&
110 git clone --filter=blob:none "file://$(pwd)/srv.bare" pc &&
111 git -C pc remote >out &&
112 - ! grep "\[blob:none\]" out &&
112 + test_grep ! "\[blob:none\]" out &&
113
114 git -C pc remote show >out &&
115 - ! grep "\[blob:none\]" out
115 + test_grep ! "\[blob:none\]" out
116 '
117
118 test_expect_success 'check remote-tracking' '
@@ -261,7 +261,7 @@ test_expect_success 'without subcommand accepts -v' '
261
262 test_expect_success 'without subcommand does not take arguments' '
263 test_expect_code 129 git -C test remote origin 2>err &&
264 - grep "^error: unknown subcommand:" err
264 + test_grep "^error: unknown subcommand:" err
265 '
266
267 cat >test/expect <<EOF
@@ -798,7 +798,7 @@ test_expect_success 'add --no-tags' '
798 cd add-no-tags &&
799 git init &&
800 git remote add -f --no-tags origin ../one &&
801 - grep tagOpt .git/config &&
801 + test_grep tagOpt .git/config &&
802 git tag -l some-tag >../test/output &&
803 git tag -l foobar-tag >../test/output &&
804 git config remote.origin.tagopt >>../test/output
@@ -972,7 +972,7 @@ test_expect_success 'rename a remote' '
972 GIT_TRACE2_EVENT=$(pwd)/trace \
973 git remote rename --progress origin upstream &&
974 test_region progress "Renaming remote references" trace &&
975 - grep "pushRemote" .git/config &&
975 + test_grep "pushRemote" .git/config &&
976 test -z "$(git for-each-ref refs/remotes/origin)" &&
977 test "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/main" &&
978 test "$(git rev-parse upstream/main)" = "$(git rev-parse main)" &&
@@ -989,7 +989,7 @@ test_expect_success 'rename a remote renames repo remote.pushDefault' '
989 cd four.1 &&
990 git config remote.pushDefault origin &&
991 git remote rename origin upstream &&
992 - grep pushDefault .git/config &&
992 + test_grep pushDefault .git/config &&
993 test "$(git config --local remote.pushDefault)" = "upstream"
994 )
995 '
@@ -1198,7 +1198,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
1198 cd eight &&
1199 git branch -a
1200 ) 2>err &&
1201 - ! grep "points nowhere" err &&
1201 + test_grep ! "points nowhere" err &&
1202 (
1203 cd eight &&
1204 test_must_fail git branch nomore origin
t/t5510-fetch.sh
+5 -5
@@ -750,7 +750,7 @@ test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge
750 # the strange name is: a\!'b
751 test_expect_success 'quoting of a strangely named repo' '
752 test_must_fail git fetch "a\\!'\''b" > result 2>&1 &&
753 - grep "fatal: '\''a\\\\!'\''b'\''" result
753 + test_grep "fatal: '\''a\\\\!'\''b'\''" result
754 '
755
756 test_expect_success 'bundle should record HEAD correctly' '
@@ -904,14 +904,14 @@ test_expect_success 'fetch --dry-run does not touch FETCH_HEAD, but still prints
904 rm -f .git/FETCH_HEAD err &&
905 git fetch --dry-run . 2>err &&
906 ! test -f .git/FETCH_HEAD &&
907 - grep FETCH_HEAD err
907 + test_grep FETCH_HEAD err
908 '
909
910 test_expect_success '--no-write-fetch-head does not touch FETCH_HEAD, and does not print what would be written' '
911 rm -f .git/FETCH_HEAD err &&
912 git fetch --no-write-fetch-head . 2>err &&
913 ! test -f .git/FETCH_HEAD &&
914 - ! grep FETCH_HEAD err
914 + test_grep ! FETCH_HEAD err
915 '
916
917 test_expect_success '--write-fetch-head gets defeated by --dry-run' '
@@ -1329,7 +1329,7 @@ test_expect_success 'fetching with auto-gc does not lock up' '
1329 git config maintenance.strategy gc &&
1330 GIT_ASK_YESNO="$TRASH_DIRECTORY/askyesno" git fetch --verbose >fetch.out 2>&1 &&
1331 test_grep "Auto packing the repository" fetch.out &&
1332 - ! grep "Should I try again" fetch.out
1332 + test_grep ! "Should I try again" fetch.out
1333 )
1334 '
1335
@@ -1338,7 +1338,7 @@ do
1338 test_expect_success "$section.hideRefs affects connectivity check" '
1339 GIT_TRACE="$PWD"/trace git -c $section.hideRefs=refs -c \
1340 $section.hideRefs="!refs/tags/" fetch &&
1341 - grep "git rev-list .*--exclude-hidden=fetch" trace
1341 + test_grep "git rev-list .*--exclude-hidden=fetch" trace
1342 '
1343 done
1344
t/t5512-ls-remote.sh
+4 -4
@@ -245,8 +245,8 @@ do
245 git config --add $configsection.hiderefs "!refs/tags/magic" &&
246 git config --add $configsection.hiderefs refs/tags/magic/one &&
247 git ls-remote . >actual &&
248 - grep refs/tags/magic/two actual &&
249 - ! grep refs/tags/magic/one actual
248 + test_grep refs/tags/magic/two actual &&
249 + test_grep ! refs/tags/magic/one actual
250 '
251
252 done
@@ -255,13 +255,13 @@ test_expect_success 'overrides work between mixed transfer/upload-pack hideRefs'
255 test_config uploadpack.hiderefs refs/tags &&
256 test_config transfer.hiderefs "!refs/tags/magic" &&
257 git ls-remote . >actual &&
258 - grep refs/tags/magic actual
258 + test_grep refs/tags/magic actual
259 '
260
261 test_expect_success 'protocol v2 supports hiderefs' '
262 test_config uploadpack.hiderefs refs/tags &&
263 git -c protocol.version=2 ls-remote . >actual &&
264 - ! grep refs/tags actual
264 + test_grep ! refs/tags actual
265 '
266
267 test_expect_success 'ls-remote --symref' '
t/t5514-fetch-multiple.sh
+1 -1
@@ -217,7 +217,7 @@ test_expect_success 'parallel' '
217
218 test_must_fail env GIT_TRACE="$PWD/trace" \
219 git fetch --jobs=2 --multiple one two 2>err &&
220 - grep "preparing to run up to 2 tasks" trace &&
220 + test_grep "preparing to run up to 2 tasks" trace &&
221 test_grep "could not fetch .one.*128" err &&
222 test_grep "could not fetch .two.*128" err
223 '
t/t5516-fetch-push.sh
+10 -10
@@ -124,7 +124,7 @@ do
124 do
125 test_expect_success "reject 'git $cmd --no-$opt'" '
126 test_must_fail git $cmd --no-$opt 2>err &&
127 - grep "unknown option .no-$opt" err
127 + test_grep "unknown option .no-$opt" err
128 '
129 done
130 done
@@ -212,7 +212,7 @@ test_expect_success 'push with negotiation' '
212 GIT_TRACE2_EVENT="$(pwd)/event" \
213 git -c protocol.version=2 -c push.negotiate=1 \
214 push testrepo refs/heads/main:refs/remotes/origin/main &&
215 - grep \"key\":\"total_rounds\",\"value\":\"1\" event &&
215 + test_grep \"key\":\"total_rounds\",\"value\":\"1\" event &&
216 grep_wrote 2 event # 1 commit, 1 tree
217 '
218
@@ -250,8 +250,8 @@ test_expect_success 'push with negotiation does not attempt to fetch submodules'
250 GIT_TRACE2_EVENT="$(pwd)/event" git -c submodule.recurse=true \
251 -c protocol.version=2 -c push.negotiate=1 \
252 push testrepo refs/heads/main:refs/remotes/origin/main 2>err &&
253 - grep \"key\":\"total_rounds\",\"value\":\"1\" event &&
254 - ! grep "Fetching submodule" err
253 + test_grep \"key\":\"total_rounds\",\"value\":\"1\" event &&
254 + test_grep ! "Fetching submodule" err
255 '
256
257 test_expect_success 'push with negotiation and remote.<name>.negotiationInclude' '
@@ -637,7 +637,7 @@ test_expect_success 'push rejects empty branch name entries' '
637 test_config branch.main.remote one &&
638 test_config branch.main.merge refs/heads/main &&
639 test_must_fail git push 2>err &&
640 - grep "bad config variable .branch\.\." err
640 + test_grep "bad config variable .branch\.\." err
641 '
642
643 test_expect_success 'push ignores "branch." config without subsection' '
@@ -923,7 +923,7 @@ test_expect_success 'warn on push to HEAD of non-bare repository' '
923 git config receive.denyCurrentBranch warn
924 ) &&
925 git push testrepo main 2>stderr &&
926 - grep "warning: updating the current branch" stderr
926 + test_grep "warning: updating the current branch" stderr
927 '
928
929 test_expect_success 'deny push to HEAD of non-bare repository' '
@@ -945,7 +945,7 @@ test_expect_success 'allow push to HEAD of bare repository (bare)' '
945 git config core.bare true
946 ) &&
947 git push testrepo main 2>stderr &&
948 - ! grep "warning: updating the current branch" stderr
948 + test_grep ! "warning: updating the current branch" stderr
949 '
950
951 test_expect_success 'allow push to HEAD of non-bare repository (config)' '
@@ -956,7 +956,7 @@ test_expect_success 'allow push to HEAD of non-bare repository (config)' '
956 git config receive.denyCurrentBranch false
957 ) &&
958 git push testrepo main 2>stderr &&
959 - ! grep "warning: updating the current branch" stderr
959 + test_grep ! "warning: updating the current branch" stderr
960 '
961
962 test_expect_success !WITH_BREAKING_CHANGES 'fetch with branches' '
@@ -1068,7 +1068,7 @@ test_expect_success 'push into aliased refs (inconsistent)' '
1068 git commit -a -m child2 &&
1069 git branch bar &&
1070 test_must_fail git push ../child1 foo bar 2>stderr &&
1071 - grep "refusing inconsistent update" stderr
1071 + test_grep "refusing inconsistent update" stderr
1072 )
1073 '
1074
@@ -1161,7 +1161,7 @@ test_expect_success 'push --porcelain' '
1161 test_expect_success 'push --porcelain bad url' '
1162 mk_empty testrepo &&
1163 test_must_fail git push >.git/bar --porcelain asdfasdfasd refs/heads/main:refs/remotes/origin/main &&
1164 - ! grep -q Done .git/bar
1164 + test_grep ! -q Done .git/bar
1165 '
1166
1167 test_expect_success 'push --porcelain rejected' '
t/t5520-pull.sh
+2 -2
@@ -356,8 +356,8 @@ test_expect_success '--rebase with rebase.autostash succeeds on ff' '
356 echo "dirty" >>dst/file &&
357 test_config -C dst rebase.autostash true &&
358 git -C dst pull --rebase >actual 2>&1 &&
359 - grep -q "Fast-forward" actual &&
360 - grep -q "Applied autostash." actual
359 + test_grep -q "Fast-forward" actual &&
360 + test_grep -q "Applied autostash." actual
361 '
362
363 test_expect_success '--rebase with conflicts shows advice' '
t/t5524-pull-msg.sh
+3 -3
@@ -31,7 +31,7 @@ test_expect_success pull '
31 git pull --no-rebase --log &&
32 git log -2 &&
33 git cat-file commit HEAD >result &&
34 - grep Dollar result
34 + test_grep Dollar result
35 )
36 '
37
@@ -44,8 +44,8 @@ test_expect_success '--log=1 limits shortlog length' '
44 git pull --no-rebase --log=1 &&
45 git log -3 &&
46 git cat-file commit HEAD >result &&
47 - grep Dollar result &&
48 - ! grep "second commit" result
47 + test_grep Dollar result &&
48 + test_grep ! "second commit" result
49 )
50 '
51
t/t5526-fetch-submodules.sh
+8 -8
@@ -199,7 +199,7 @@ test_expect_success "fetch --recurse-submodules -j2 has the same output behaviou
199 ) &&
200 test_must_be_empty actual.out &&
201 verify_fetch_result actual.err &&
202 - grep "2 tasks" trace.out
202 + test_grep "2 tasks" trace.out
203 '
204
205 test_expect_success "fetch alone only fetches superproject" '
@@ -723,25 +723,25 @@ test_expect_success 'fetching submodules respects parallel settings' '
723 (
724 cd downstream &&
725 GIT_TRACE=$(pwd)/trace.out git fetch &&
726 - grep "1 tasks" trace.out &&
726 + test_grep "1 tasks" trace.out &&
727 >trace.out &&
728
729 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 7 &&
730 - grep "7 tasks" trace.out &&
730 + test_grep "7 tasks" trace.out &&
731 >trace.out &&
732
733 git config submodule.fetchJobs 8 &&
734 GIT_TRACE=$(pwd)/trace.out git fetch &&
735 - grep "8 tasks" trace.out &&
735 + test_grep "8 tasks" trace.out &&
736 >trace.out &&
737
738 GIT_TRACE=$(pwd)/trace.out git fetch --jobs 9 &&
739 - grep "9 tasks" trace.out &&
739 + test_grep "9 tasks" trace.out &&
740 >trace.out &&
741
742 GIT_TRACE=$(pwd)/trace.out git -c submodule.fetchJobs=0 fetch &&
743 - grep "preparing to run up to [0-9]* tasks" trace.out &&
744 - ! grep "up to 0 tasks" trace.out &&
743 + test_grep "preparing to run up to [0-9]* tasks" trace.out &&
744 + test_grep ! "up to 0 tasks" trace.out &&
745 >trace.out
746 )
747 '
@@ -1259,7 +1259,7 @@ test_expect_success "fetch --all with --no-recurse-submodules only fetches super
1259 git config submodule.recurse true &&
1260 git fetch --all --no-recurse-submodules 2>../fetch-log
1261 ) &&
1262 - ! grep "Fetching submodule" fetch-log
1262 + test_grep ! "Fetching submodule" fetch-log
1263 '
1264
1265 test_done
t/t5529-push-errors.sh
+2 -2
@@ -44,14 +44,14 @@ test_expect_success 'detect missing sha1 expressions early' '
44 # 'builtin/push.c:set_refspecs()' and we want to test that regression.
45 test_expect_success 'detect empty remote with existing local ref' '
46 test_must_fail git push "" main 2> stderr &&
47 - grep "fatal: bad repository ${SQ}${SQ}" stderr
47 + test_grep "fatal: bad repository ${SQ}${SQ}" stderr
48 '
49
50 # While similar to the previous test, here we want to ensure that
51 # even targeted refspecs are handled.
52 test_expect_success 'detect empty remote with targeted refspec' '
53 test_must_fail git push "" HEAD:refs/heads/main 2> stderr &&
54 - grep "fatal: bad repository ${SQ}${SQ}" stderr
54 + test_grep "fatal: bad repository ${SQ}${SQ}" stderr
55 '
56
57 test_expect_success 'detect ambiguous refs early' '
t/t5530-upload-pack-error.sh
+9 -9
@@ -44,16 +44,16 @@ test_expect_success 'upload-pack fails due to error in rev-list' '
44 $(($hexsz + 10)) $(git rev-parse HEAD) \
45 $(($hexsz + 12)) $(git rev-parse HEAD^) >input &&
46 test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
47 - grep "bad tree object" output.err
47 + test_grep "bad tree object" output.err
48 '
49
50 test_expect_success 'upload-pack fails due to bad want (no object)' '
51 printf "%04xwant %s multi_ack_detailed\n00000009done\n0000" \
52 $(($hexsz + 29)) $(test_oid deadbeef) >input &&
53 test_must_fail git upload-pack . <input >output 2>output.err &&
54 - grep "not our ref" output.err &&
55 - grep "ERR" output &&
56 - ! grep multi_ack_detailed output.err
54 + test_grep "not our ref" output.err &&
55 + test_grep "ERR" output &&
56 + test_grep ! multi_ack_detailed output.err
57 '
58
59 test_expect_success 'upload-pack fails due to bad want (not tip)' '
@@ -61,17 +61,17 @@ test_expect_success 'upload-pack fails due to bad want (not tip)' '
61 printf "%04xwant %s multi_ack_detailed\n00000009done\n0000" \
62 $(($hexsz + 29)) "$oid" >input &&
63 test_must_fail git upload-pack . <input >output 2>output.err &&
64 - grep "not our ref" output.err &&
65 - grep "ERR" output &&
66 - ! grep multi_ack_detailed output.err
64 + test_grep "not our ref" output.err &&
65 + test_grep "ERR" output &&
66 + test_grep ! multi_ack_detailed output.err
67 '
68
69 test_expect_success 'upload-pack fails due to error in pack-objects enumeration' '
70 printf "%04xwant %s\n00000009done\n0000" \
71 $((hexsz + 10)) $(git rev-parse HEAD) >input &&
72 test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
73 - grep "bad tree object" output.err &&
74 - grep "pack-objects died" output.err
73 + test_grep "bad tree object" output.err &&
74 + test_grep "pack-objects died" output.err
75 '
76
77 test_expect_success 'upload-pack tolerates EOF just after stateless client wants' '
t/t5531-deep-submodule-push.sh
+1 -1
@@ -559,7 +559,7 @@ test_expect_success 'push with push.recurseSubmodules=only on superproject and t
559 test_must_fail git -C upstream rev-parse refs/heads/downstream-branch &&
560 git -C upstream/sub rev-parse refs/heads/downstream-branch &&
561 git -C upstream/sub/deepsub rev-parse refs/heads/downstream-branch &&
562 - grep "recursing into submodule with push.recurseSubmodules=only; using on-demand instead" err
562 + test_grep "recursing into submodule with push.recurseSubmodules=only; using on-demand instead" err
563 '
564
565 test_expect_success 'push propagating the remotes name to a submodule' '
t/t5532-fetch-proxy.sh
+1 -1
@@ -52,7 +52,7 @@ test_expect_success 'fetch through proxy works' '
52
53 test_expect_success 'funny hostnames are rejected before running proxy' '
54 test_must_fail git fetch git://-remote/repo.git 2>stderr &&
55 - ! grep "proxying for" stderr
55 + test_grep ! "proxying for" stderr
56 '
57
58 test_done
t/t5533-push-cas.sh
+6 -6
@@ -69,7 +69,7 @@ test_expect_success 'push to update (protected)' '
69 cd dst &&
70 test_commit D &&
71 test_must_fail git push --force-with-lease=main:main origin main 2>err &&
72 - grep "stale info" err
72 + test_grep "stale info" err
73 ) &&
74 git ls-remote . refs/heads/main >expect &&
75 git ls-remote src refs/heads/main >actual &&
@@ -82,7 +82,7 @@ test_expect_success 'push to update (protected, forced)' '
82 cd dst &&
83 test_commit D &&
84 git push --force --force-with-lease=main:main origin main 2>err &&
85 - grep "forced update" err
85 + test_grep "forced update" err
86 ) &&
87 git ls-remote dst refs/heads/main >expect &&
88 git ls-remote src refs/heads/main >actual &&
@@ -147,7 +147,7 @@ test_expect_success 'push to update (allowed, tracking)' '
147 cd dst &&
148 test_commit D &&
149 git push --force-with-lease=main origin main 2>err &&
150 - ! grep "forced update" err
150 + test_grep ! "forced update" err
151 ) &&
152 git ls-remote dst refs/heads/main >expect &&
153 git ls-remote src refs/heads/main >actual &&
@@ -161,7 +161,7 @@ test_expect_success 'push to update (allowed even though no-ff)' '
161 git reset --hard HEAD^ &&
162 test_commit D &&
163 git push --force-with-lease=main origin main 2>err &&
164 - grep "forced update" err
164 + test_grep "forced update" err
165 ) &&
166 git ls-remote dst refs/heads/main >expect &&
167 git ls-remote src refs/heads/main >actual &&
@@ -194,7 +194,7 @@ test_expect_success 'push to delete (allowed)' '
194 (
195 cd dst &&
196 git push --force-with-lease=main origin :main 2>err &&
197 - grep deleted err
197 + test_grep deleted err
198 ) &&
199 git ls-remote src refs/heads/main >actual &&
200 test_must_be_empty actual
@@ -350,7 +350,7 @@ test_expect_success '"--force-if-includes" should be disabled for --force-with-l
350 remote_head="$(git rev-parse refs/remotes/origin/main)" &&
351 git fetch --all &&
352 test_must_fail git push --force-if-includes --force-with-lease="main:$remote_head" 2>err &&
353 - grep "stale info" err
353 + test_grep "stale info" err
354 ) &&
355 git ls-remote dst refs/heads/main >actual.main &&
356 test_cmp expect.main actual.main
t/t5534-push-signed.sh
+11 -11
@@ -126,8 +126,8 @@ test_expect_success GPG 'signed push sends push certificate' '
126 noop=$(git rev-parse noop) &&
127 ff=$(git rev-parse ff) &&
128 noff=$(git rev-parse noff) &&
129 - grep "$noop $ff refs/heads/ff" dst/push-cert &&
130 - grep "$noop $noff refs/heads/noff" dst/push-cert &&
129 + test_grep "$noop $ff refs/heads/ff" dst/push-cert &&
130 + test_grep "$noop $noff refs/heads/noff" dst/push-cert &&
131 test_cmp expect dst/push-cert-status
132 '
133
@@ -172,8 +172,8 @@ test_expect_success GPGSSH 'ssh signed push sends push certificate' '
172 noop=$(git rev-parse noop) &&
173 ff=$(git rev-parse ff) &&
174 noff=$(git rev-parse noff) &&
175 - grep "$noop $ff refs/heads/ff" dst/push-cert &&
176 - grep "$noop $noff refs/heads/noff" dst/push-cert &&
175 + test_grep "$noop $ff refs/heads/ff" dst/push-cert &&
176 + test_grep "$noop $noff refs/heads/noff" dst/push-cert &&
177 test_cmp expect dst/push-cert-status
178 '
179
@@ -211,7 +211,7 @@ test_expect_success GPG 'inconsistent push options in signed push not allowed' '
211 git -C dst config receive.advertisepushoptions 1 &&
212 git receive-pack dst <push.tweak >out &&
213 git -C dst rev-parse ff &&
214 - grep "inconsistent push options" out
214 + test_grep "inconsistent push options" out
215 '
216
217 test_expect_success GPG 'fail without key and heed user.signingkey' '
@@ -257,8 +257,8 @@ test_expect_success GPG 'fail without key and heed user.signingkey' '
257 noop=$(git rev-parse noop) &&
258 ff=$(git rev-parse ff) &&
259 noff=$(git rev-parse noff) &&
260 - grep "$noop $ff refs/heads/ff" dst/push-cert &&
261 - grep "$noop $noff refs/heads/noff" dst/push-cert &&
260 + test_grep "$noop $ff refs/heads/ff" dst/push-cert &&
261 + test_grep "$noop $noff refs/heads/noff" dst/push-cert &&
262 test_cmp expect dst/push-cert-status
263 '
264
@@ -309,8 +309,8 @@ test_expect_success GPGSM 'fail without key and heed user.signingkey x509' '
309 noop=$(git rev-parse noop) &&
310 ff=$(git rev-parse ff) &&
311 noff=$(git rev-parse noff) &&
312 - grep "$noop $ff refs/heads/ff" dst/push-cert &&
313 - grep "$noop $noff refs/heads/noff" dst/push-cert &&
312 + test_grep "$noop $ff refs/heads/ff" dst/push-cert &&
313 + test_grep "$noop $noff refs/heads/noff" dst/push-cert &&
314 test_cmp expect dst/push-cert-status
315 '
316
@@ -362,8 +362,8 @@ test_expect_success GPGSSH 'fail without key and heed user.signingkey ssh' '
362 noop=$(git rev-parse noop) &&
363 ff=$(git rev-parse ff) &&
364 noff=$(git rev-parse noff) &&
365 - grep "$noop $ff refs/heads/ff" dst/push-cert &&
366 - grep "$noop $noff refs/heads/noff" dst/push-cert &&
365 + test_grep "$noop $ff refs/heads/ff" dst/push-cert &&
366 + test_grep "$noop $noff refs/heads/noff" dst/push-cert &&
367 test_cmp expect dst/push-cert-status
368 '
369
t/t5537-fetch-shallow.sh
+1 -1
@@ -244,7 +244,7 @@ test_expect_success '.git/shallow is edited by repack' '
244 origin "+refs/heads/*:refs/remotes/origin/*" &&
245 git -C shallow-client repack -adfl &&
246 test_must_fail git -C shallow-client rev-parse --verify $d^0 &&
247 - ! grep $d shallow-client/.git/shallow &&
247 + test_grep ! $d shallow-client/.git/shallow &&
248
249 git -C shallow-server branch branch-orig $d &&
250 git -C shallow-client fetch --prune --depth=2 \
t/t5538-push-shallow.sh
+1 -1
@@ -65,7 +65,7 @@ test_expect_success 'push from shallow clone, with grafted roots' '
65 (
66 cd shallow2 &&
67 test_must_fail git push ../.git +main:refs/remotes/shallow2/main 2>err &&
68 - grep "shallow2/main.*shallow update not allowed" err
68 + test_grep "shallow2/main.*shallow update not allowed" err
69 ) &&
70 test_must_fail git rev-parse shallow2/main &&
71 git fsck
t/t5539-fetch-http-shallow.sh
+2 -2
@@ -76,8 +76,8 @@ test_expect_success 'no shallow lines after receiving ACK ready' '
76 # might be able to run this test in all protocol versions.
77 GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" GIT_TEST_PROTOCOL_VERSION=0 \
78 git fetch --depth=2 &&
79 - grep "fetch-pack< ACK .* ready" ../trace &&
80 - ! grep "fetch-pack> done" ../trace
79 + test_grep "fetch-pack< ACK .* ready" ../trace &&
80 + test_grep ! "fetch-pack> done" ../trace
81 )
82 '
83
t/t5541-http-push-smart.sh
+16 -16
@@ -56,8 +56,8 @@ test_expect_success 'push to remote repository (standard)' '
56 git commit -m path2 &&
57 HEAD=$(git rev-parse --verify HEAD) &&
58 GIT_TRACE_CURL=true git push -v -v 2>err &&
59 - ! grep "Expect: 100-continue" err &&
60 - grep "POST git-receive-pack ([0-9]* bytes)" err &&
59 + test_grep ! "Expect: 100-continue" err &&
60 + test_grep "POST git-receive-pack ([0-9]* bytes)" err &&
61 (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
62 test $HEAD = $(git rev-parse --verify HEAD))
63 '
@@ -84,7 +84,7 @@ test_expect_success 'push to remote repository (standard) with sending Accept-La
84 git commit -m path_lang &&
85 HEAD=$(git rev-parse --verify HEAD) &&
86 GIT_TRACE_CURL=true LANGUAGE="ko_KR.UTF-8" git push -v -v 2>err &&
87 - ! grep "Expect: 100-continue" err &&
87 + test_grep ! "Expect: 100-continue" err &&
88
89 grep "=> Send header: Accept-Language:" err >err.language &&
90 test_cmp exp err.language
@@ -148,8 +148,8 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
148 test_must_fail git push -v origin +main main:niam >output 2>&1'
149
150 test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: remote output' '
151 - grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *main -> main (forced update)$" output &&
152 - grep "^ ! \[rejected\] *main -> niam (non-fast-forward)$" output
151 + test_grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *main -> main (forced update)$" output &&
152 + test_grep "^ ! \[rejected\] *main -> niam (non-fast-forward)$" output
153 '
154
155 test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: our output' '
@@ -163,7 +163,7 @@ test_expect_success 'push (chunked)' '
163 HEAD=$(git rev-parse --verify HEAD) &&
164 test_config http.postbuffer 4 &&
165 git push -v -v origin $BRANCH 2>err &&
166 - grep "POST git-receive-pack (chunked)" err &&
166 + test_grep "POST git-receive-pack (chunked)" err &&
167 (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
168 test $HEAD = $(git rev-parse --verify HEAD))
169 '
@@ -215,15 +215,15 @@ test_expect_success 'push --atomic also prevents branch creation, reports collat
215 test_cmp expected actual &&
216
217 # the failed refs should be indicated to the user
218 - grep "^ ! .*rejected.* main -> main" output &&
218 + test_grep "^ ! .*rejected.* main -> main" output &&
219
220 # the collateral failure refs should be indicated to the user
221 - grep "^ ! .*rejected.* atomic -> atomic .*atomic push failed" output &&
222 - grep "^ ! .*rejected.* collateral -> collateral .*atomic push failed" output &&
221 + test_grep "^ ! .*rejected.* atomic -> atomic .*atomic push failed" output &&
222 + test_grep "^ ! .*rejected.* collateral -> collateral .*atomic push failed" output &&
223
224 # never report what we do not push
225 - ! grep "^ ! .*rejected.* atomic1 " output &&
226 - ! grep "^ ! .*rejected.* other " output
225 + test_grep ! "^ ! .*rejected.* atomic1 " output &&
226 + test_grep ! "^ ! .*rejected.* other " output
227 '
228
229 test_expect_success 'push --atomic fails on server-side errors' '
@@ -247,10 +247,10 @@ test_expect_success 'push --atomic fails on server-side errors' '
247 test_must_fail git -C "$d" show-ref --verify refs/heads/other &&
248
249 # the failed refs should be indicated to the user
250 - grep "^ ! .*rejected.* other -> other .*atomic transaction failed" output &&
250 + test_grep "^ ! .*rejected.* other -> other .*atomic transaction failed" output &&
251
252 # the collateral failure refs should be indicated to the user
253 - grep "^ ! .*rejected.* atomic -> atomic .*atomic transaction failed" output
253 + test_grep "^ ! .*rejected.* atomic -> atomic .*atomic transaction failed" output
254 '
255
256 test_expect_success 'push --all can push to empty repo' '
@@ -442,7 +442,7 @@ test_expect_success 'push status output scrubs password' '
442 "$HTTPD_URL_USER_PASS/smart/test_repo.git" \
443 +HEAD:scrub >status &&
444 # should have been scrubbed down to vanilla URL
445 - grep "^To $HTTPD_URL/smart/test_repo.git" status
445 + test_grep "^To $HTTPD_URL/smart/test_repo.git" status
446 '
447
448 test_expect_success 'clone/fetch scrubs password from reflogs' '
@@ -456,8 +456,8 @@ test_expect_success 'clone/fetch scrubs password from reflogs' '
456 +main:main &&
457 # should have been scrubbed down to vanilla URL
458 git log -g main >reflog &&
459 - grep "$HTTPD_URL" reflog &&
460 - ! grep "$HTTPD_URL_USER_PASS" reflog
459 + test_grep "$HTTPD_URL" reflog &&
460 + test_grep ! "$HTTPD_URL_USER_PASS" reflog
461 '
462
463 test_expect_success 'Non-ASCII branch name can be used with --force-with-lease' '
t/t5544-pack-objects-hook.sh
+6 -6
@@ -27,7 +27,7 @@ test_expect_success 'hook runs via global config' '
27 clear_hook_results &&
28 test_config_global uploadpack.packObjectsHook ./hook &&
29 git clone --no-local . dst.git 2>stderr &&
30 - grep "hook running" stderr
30 + test_grep "hook running" stderr
31 '
32
33 test_expect_success 'hook outputs are sane' '
@@ -38,7 +38,7 @@ test_expect_success 'hook outputs are sane' '
38 # the full argument list or the exact pack contents, as it would make
39 # the test brittle. So just sanity check that we could replay
40 # the packing procedure.
41 - grep "^git" .git/hook.args &&
41 + test_grep "^git" .git/hook.args &&
42 $(cat .git/hook.args) <.git/hook.stdin >replay
43 '
44
@@ -47,14 +47,14 @@ test_expect_success 'hook runs from -c config' '
47 git clone --no-local \
48 -u "git -c uploadpack.packObjectsHook=./hook upload-pack" \
49 . dst.git 2>stderr &&
50 - grep "hook running" stderr
50 + test_grep "hook running" stderr
51 '
52
53 test_expect_success 'hook does not run from repo config' '
54 clear_hook_results &&
55 test_config uploadpack.packObjectsHook "./hook" &&
56 git clone --no-local . dst.git 2>stderr &&
57 - ! grep "hook running" stderr &&
57 + test_grep ! "hook running" stderr &&
58 test_path_is_missing .git/hook.args &&
59 test_path_is_missing .git/hook.stdin &&
60 test_path_is_missing .git/hook.stdout &&
@@ -62,7 +62,7 @@ test_expect_success 'hook does not run from repo config' '
62 # check that global config is used instead
63 test_config_global uploadpack.packObjectsHook ./hook &&
64 git clone --no-local . dst2.git 2>stderr &&
65 - grep "hook running" stderr
65 + test_grep "hook running" stderr
66 '
67
68 test_expect_success 'hook works with partial clone' '
@@ -72,7 +72,7 @@ test_expect_success 'hook works with partial clone' '
72 git clone --bare --no-local --filter=blob:none . dst.git &&
73 git -C dst.git rev-list --objects --missing=allow-any --no-object-names --all >objects &&
74 git -C dst.git cat-file --batch-check="%(objecttype)" <objects >types &&
75 - ! grep blob types
75 + test_grep ! blob types
76 '
77
78 test_done
t/t5550-http-fetch-dumb.sh
+2 -2
@@ -124,7 +124,7 @@ test_expect_success 'netrc authorized but forbidden credentials (fail on 403)' '
124 set_netrc 127.0.0.1 forbidden-user@host pass@host &&
125 test_must_fail git clone "$HTTPD_URL/auth/dumb/repo.git" clone-auth-netrc-403 2>err &&
126 expect_askpass none &&
127 - grep "The requested URL returned error: 403" err
127 + test_grep "The requested URL returned error: 403" err
128 '
129
130 test_expect_success 'http auth can use user/pass in URL' '
@@ -280,7 +280,7 @@ test_expect_success 'http-fetch --packfile' '
280 --index-pack-arg=--keep \
281 "$HTTPD_URL"/dumb/repo_pack.git/$p >out &&
282
283 - grep -E "^keep.[0-9a-f]{16,}$" out &&
283 + test_grep -E "^keep.[0-9a-f]{16,}$" out &&
284 cut -c6- out >packhash &&
285
286 # Ensure that the expected files are generated
t/t5551-http-fetch-smart.sh
+23 -23
@@ -164,8 +164,8 @@ test_expect_success 'fetch changes via http' '
164
165 test_expect_success 'used upload-pack service' '
166 strip_access_log >log &&
167 - grep "GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/[0-9.]* 200" log &&
168 - grep "POST /smart/repo.git/git-upload-pack HTTP/[0-9.]* 200" log
167 + test_grep "GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/[0-9.]* 200" log &&
168 + test_grep "POST /smart/repo.git/git-upload-pack HTTP/[0-9.]* 200" log
169 '
170
171 test_expect_success 'follow redirects (301)' '
@@ -264,8 +264,8 @@ test_expect_success 'GIT_TRACE_CURL redacts auth details' '
264
265 # Ensure that there is no "Basic" followed by a base64 string, but that
266 # the auth details are redacted
267 - ! grep -i "Authorization: Basic [0-9a-zA-Z+/]" trace &&
268 - grep -i "Authorization: Basic <redacted>" trace
267 + test_grep ! -i "Authorization: Basic [0-9a-zA-Z+/]" trace &&
268 + test_grep -i "Authorization: Basic <redacted>" trace
269 '
270
271 test_expect_success 'GIT_CURL_VERBOSE redacts auth details' '
@@ -276,8 +276,8 @@ test_expect_success 'GIT_CURL_VERBOSE redacts auth details' '
276
277 # Ensure that there is no "Basic" followed by a base64 string, but that
278 # the auth details are redacted
279 - ! grep -i "Authorization: Basic [0-9a-zA-Z+/]" trace &&
280 - grep -i "Authorization: Basic <redacted>" trace
279 + test_grep ! -i "Authorization: Basic [0-9a-zA-Z+/]" trace &&
280 + test_grep -i "Authorization: Basic <redacted>" trace
281 '
282
283 test_expect_success 'GIT_TRACE_CURL does not redact auth details if GIT_TRACE_REDACT=0' '
@@ -287,7 +287,7 @@ test_expect_success 'GIT_TRACE_CURL does not redact auth details if GIT_TRACE_RE
287 git clone --bare "$HTTPD_URL/auth/smart/repo.git" redact-auth &&
288 expect_askpass both user%40host &&
289
290 - grep -i "Authorization: Basic [0-9a-zA-Z+/]" trace
290 + test_grep -i "Authorization: Basic [0-9a-zA-Z+/]" trace
291 '
292
293 test_expect_success 'disable dumb http on server' '
@@ -418,7 +418,7 @@ test_expect_success 'large fetch-pack requests can be sent using chunked encodin
418 clone --bare "$HTTPD_URL/smart/repo.git" split.git 2>err &&
419 {
420 test_have_prereq HTTP2 ||
421 - grep "^=> Send header: Transfer-Encoding: chunked" err
421 + test_grep "^=> Send header: Transfer-Encoding: chunked" err
422 }
423 '
424
@@ -553,10 +553,10 @@ test_expect_success 'cookies are redacted by default' '
553 GIT_TRACE_CURL=true \
554 git -c "http.cookieFile=$(pwd)/cookies" clone \
555 $HTTPD_URL/smart/repo.git clone 2>err &&
556 - grep -i "Cookie:.*Foo=<redacted>" err &&
557 - grep -i "Cookie:.*Bar=<redacted>" err &&
558 - ! grep -i "Cookie:.*Foo=1" err &&
559 - ! grep -i "Cookie:.*Bar=2" err
556 + test_grep -i "Cookie:.*Foo=<redacted>" err &&
557 + test_grep -i "Cookie:.*Bar=<redacted>" err &&
558 + test_grep ! -i "Cookie:.*Foo=1" err &&
559 + test_grep ! -i "Cookie:.*Bar=2" err
560 '
561
562 test_expect_success 'empty values of cookies are also redacted' '
@@ -565,7 +565,7 @@ test_expect_success 'empty values of cookies are also redacted' '
565 GIT_TRACE_CURL=true \
566 git -c "http.cookieFile=$(pwd)/cookies" clone \
567 $HTTPD_URL/smart/repo.git clone 2>err &&
568 - grep -i "Cookie:.*Foo=<redacted>" err
568 + test_grep -i "Cookie:.*Foo=<redacted>" err
569 '
570
571 test_expect_success 'GIT_TRACE_REDACT=0 disables cookie redaction' '
@@ -575,20 +575,20 @@ test_expect_success 'GIT_TRACE_REDACT=0 disables cookie redaction' '
575 GIT_TRACE_REDACT=0 GIT_TRACE_CURL=true \
576 git -c "http.cookieFile=$(pwd)/cookies" clone \
577 $HTTPD_URL/smart/repo.git clone 2>err &&
578 - grep -i "Cookie:.*Foo=1" err &&
579 - grep -i "Cookie:.*Bar=2" err
578 + test_grep -i "Cookie:.*Foo=1" err &&
579 + test_grep -i "Cookie:.*Bar=2" err
580 '
581
582 test_expect_success 'GIT_TRACE_CURL_NO_DATA prevents data from being traced' '
583 rm -rf clone &&
584 GIT_TRACE_CURL=true \
585 git clone $HTTPD_URL/smart/repo.git clone 2>err &&
586 - grep "=> Send data" err &&
586 + test_grep "=> Send data" err &&
587
588 rm -rf clone &&
589 GIT_TRACE_CURL=true GIT_TRACE_CURL_NO_DATA=1 \
590 git clone $HTTPD_URL/smart/repo.git clone 2>err &&
591 - ! grep "=> Send data" err
591 + test_grep ! "=> Send data" err
592 '
593
594 test_expect_success 'server-side error detected' '
@@ -643,7 +643,7 @@ test_expect_success 'client falls back from v2 to v0 to match server' '
643 git clone $HTTPD_URL/smart_v0/repo.git repo-v0 &&
644 # check for v0; there the HEAD symref is communicated in the capability
645 # line; v2 uses a different syntax on each ref advertisement line
646 - grep symref=HEAD:refs/heads/ trace
646 + test_grep symref=HEAD:refs/heads/ trace
647 '
648
649 test_expect_success 'create empty http-accessible SHA-256 repository' '
@@ -691,7 +691,7 @@ test_expect_success 'clone warns or fails when using username:password' '
691
692 git -c transfer.credentialsInUrl=allow \
693 clone $url_userpass attempt1 2>err &&
694 - ! grep "$message" err &&
694 + test_grep ! "$message" err &&
695
696 git -c transfer.credentialsInUrl=warn \
697 clone $url_userpass attempt2 2>err &&
@@ -720,12 +720,12 @@ test_expect_success 'clone does not detect username:password when it is https://
720 esac &&
721
722 git -c transfer.credentialsInUrl=warn clone $url_user attempt1 2>err &&
723 - ! grep "uses plaintext credentials" err
723 + test_grep ! "uses plaintext credentials" err
724 '
725
726 test_expect_success 'fetch warns or fails when using username:password' '
727 git -c transfer.credentialsInUrl=allow fetch $url_userpass 2>err &&
728 - ! grep "$message" err &&
728 + test_grep ! "$message" err &&
729
730 git -c transfer.credentialsInUrl=warn fetch $url_userpass 2>err &&
731 grep "warning: $message" err >warnings &&
@@ -745,7 +745,7 @@ test_expect_success 'fetch warns or fails when using username:password' '
745
746 test_expect_success 'push warns or fails when using username:password' '
747 git -c transfer.credentialsInUrl=allow push $url_userpass 2>err &&
748 - ! grep "$message" err &&
748 + test_grep ! "$message" err &&
749
750 git -c transfer.credentialsInUrl=warn push $url_userpass 2>err &&
751 grep "warning: $message" err >warnings &&
@@ -762,7 +762,7 @@ test_expect_success 'no empty path components' '
762 git clone $HTTPD_URL/smart/repo.git/ clone-with-slash &&
763
764 strip_access_log >log &&
765 - ! grep "//" log
765 + test_grep ! "//" log
766 '
767
768 test_expect_success 'tag following always works over v0 http' '
t/t5552-skipping-fetch-negotiator.sh
+3 -3
@@ -201,7 +201,7 @@ test_expect_success 'do not send "have" with ancestors of commits that server AC
201 export GIT_TEST_PROTOCOL_VERSION &&
202 trace_fetch client "$(pwd)/server" to_fetch
203 ) &&
204 - grep " fetch" trace &&
204 + test_grep " fetch" trace &&
205
206 # fetch-pack sends 2 requests each containing 16 "have" lines before
207 # processing the first response. In these 2 requests, 4 commits from
@@ -211,8 +211,8 @@ test_expect_success 'do not send "have" with ancestors of commits that server AC
211
212 # While fetch-pack is processing the first response, it should read that
213 # the server ACKs b1.c19 and b1.c17.
214 - grep "fetch< ACK $(git -C client rev-parse b1.c19) common" trace &&
215 - grep "fetch< ACK $(git -C client rev-parse b1.c17) common" trace &&
214 + test_grep "fetch< ACK $(git -C client rev-parse b1.c19) common" trace &&
215 + test_grep "fetch< ACK $(git -C client rev-parse b1.c17) common" trace &&
216
217 # fetch-pack should thus not send any more commits in the b1 branch, but
218 # should still send the others (in this test, just check b2).
t/t5554-noop-fetch-negotiator.sh
+2 -2
@@ -16,8 +16,8 @@ test_expect_success 'noop negotiator does not emit any "have"' '
16 test_config -C client fetch.negotiationalgorithm noop &&
17 GIT_TRACE_PACKET="$(pwd)/trace" git -C client fetch "$(pwd)/server" &&
18
19 - ! grep "fetch> have" trace &&
20 - grep "fetch> done" trace
19 + test_grep ! "fetch> have" trace &&
20 + test_grep "fetch> done" trace
21 '
22
23 test_done
t/t5557-http-get.sh
+1 -1
@@ -18,7 +18,7 @@ test_expect_success 'get by URL: 404' '
18
19 test_must_fail git remote-http $url <input 2>err &&
20 test_path_is_missing file1 &&
21 - grep "failed to download file at URL" err
21 + test_grep "failed to download file at URL" err
22 '
23
24 test_expect_success 'get by URL: 200' '
t/t5558-clone-bundle-uri.sh
+19 -19
@@ -8,14 +8,14 @@ test_description='test fetching bundles with --bundle-uri'
8 test_expect_success 'fail to clone from non-existent file' '
9 test_when_finished rm -rf test &&
10 git clone --bundle-uri="$(pwd)/does-not-exist" . test 2>err &&
11 - grep "failed to download bundle from URI" err
11 + test_grep "failed to download bundle from URI" err
12 '
13
14 test_expect_success 'fail to clone from non-bundle file' '
15 test_when_finished rm -rf test &&
16 echo bogus >bogus &&
17 git clone --bundle-uri="$(pwd)/bogus" . test 2>err &&
18 - grep "is not a bundle" err
18 + test_grep "is not a bundle" err
19 '
20
21 test_expect_success 'create bundle' '
@@ -197,7 +197,7 @@ test_expect_success 'clone bundle list (file, no heuristic)' '
197
198 git clone --bundle-uri="file://$(pwd)/bundle-list" \
199 clone-from clone-list-file 2>err &&
200 - ! grep "Repository lacks these prerequisite commits" err &&
200 + test_grep ! "Repository lacks these prerequisite commits" err &&
201
202 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
203 git -C clone-list-file cat-file --batch-check <oids &&
@@ -242,9 +242,9 @@ test_expect_success 'clone bundle list (file, all mode, some failures)' '
242 GIT_TRACE2_PERF=1 \
243 git clone --bundle-uri="file://$(pwd)/bundle-list" \
244 clone-from clone-all-some 2>err &&
245 - ! grep "Repository lacks these prerequisite commits" err &&
246 - ! grep "fatal" err &&
247 - grep "warning: failed to download bundle from URI" err &&
245 + test_grep ! "Repository lacks these prerequisite commits" err &&
246 + test_grep ! "fatal" err &&
247 + test_grep "warning: failed to download bundle from URI" err &&
248
249 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
250 git -C clone-all-some cat-file --batch-check <oids &&
@@ -275,15 +275,15 @@ test_expect_success 'clone bundle list (file, all mode, all failures)' '
275
276 git clone --bundle-uri="file://$(pwd)/bundle-list" \
277 clone-from clone-all-fail 2>err &&
278 - ! grep "Repository lacks these prerequisite commits" err &&
279 - ! grep "fatal" err &&
280 - grep "warning: failed to download bundle from URI" err &&
278 + test_grep ! "Repository lacks these prerequisite commits" err &&
279 + test_grep ! "fatal" err &&
280 + test_grep "warning: failed to download bundle from URI" err &&
281
282 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
283 git -C clone-all-fail cat-file --batch-check <oids &&
284
285 git -C clone-all-fail for-each-ref --format="%(refname)" >refs &&
286 - ! grep "refs/bundles/heads/" refs
286 + test_grep ! "refs/bundles/heads/" refs
287 '
288
289 test_expect_success 'clone bundle list (file, any mode)' '
@@ -306,7 +306,7 @@ test_expect_success 'clone bundle list (file, any mode)' '
306
307 git clone --bundle-uri="file://$(pwd)/bundle-list" \
308 clone-from clone-any-file 2>err &&
309 - ! grep "Repository lacks these prerequisite commits" err &&
309 + test_grep ! "Repository lacks these prerequisite commits" err &&
310
311 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
312 git -C clone-any-file cat-file --batch-check <oids &&
@@ -336,14 +336,14 @@ test_expect_success 'clone bundle list (file, any mode, all failures)' '
336
337 git clone --bundle-uri="file://$(pwd)/bundle-list" \
338 clone-from clone-any-fail 2>err &&
339 - ! grep "fatal" err &&
340 - grep "warning: failed to download bundle from URI" err &&
339 + test_grep ! "fatal" err &&
340 + test_grep "warning: failed to download bundle from URI" err &&
341
342 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
343 git -C clone-any-fail cat-file --batch-check <oids &&
344
345 git -C clone-any-fail for-each-ref --format="%(refname)" >refs &&
346 - ! grep "refs/bundles/heads/" refs
346 + test_grep ! "refs/bundles/heads/" refs
347 '
348
349 test_expect_success 'negotiation: bundle with part of wanted commits' '
@@ -477,14 +477,14 @@ start_httpd
477 test_expect_success 'fail to fetch from non-existent HTTP URL' '
478 test_when_finished rm -rf test &&
479 git clone --bundle-uri="$HTTPD_URL/does-not-exist" . test 2>err &&
480 - grep "failed to download bundle from URI" err
480 + test_grep "failed to download bundle from URI" err
481 '
482
483 test_expect_success 'fail to fetch from non-bundle HTTP URL' '
484 test_when_finished rm -rf test &&
485 echo bogus >"$HTTPD_DOCUMENT_ROOT_PATH/bogus" &&
486 git clone --bundle-uri="$HTTPD_URL/bogus" . test 2>err &&
487 - grep "is not a bundle" err
487 + test_grep "is not a bundle" err
488 '
489
490 test_expect_success 'clone HTTP bundle' '
@@ -536,7 +536,7 @@ test_expect_success 'clone bundle list (HTTP, no heuristic)' '
536 GIT_TRACE2_EVENT="$(pwd)/trace-clone.txt" \
537 git clone --bundle-uri="$HTTPD_URL/bundle-list" \
538 clone-from clone-list-http 2>err &&
539 - ! grep "Repository lacks these prerequisite commits" err &&
539 + test_grep ! "Repository lacks these prerequisite commits" err &&
540
541 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
542 git -C clone-list-http cat-file --batch-check <oids &&
@@ -576,8 +576,8 @@ test_expect_success 'clone bundle list (HTTP, any mode)' '
576
577 git clone --bundle-uri="$HTTPD_URL/bundle-list" \
578 clone-from clone-any-http 2>err &&
579 - ! grep "fatal" err &&
580 - grep "warning: failed to download bundle from URI" err &&
579 + test_grep ! "fatal" err &&
580 + test_grep "warning: failed to download bundle from URI" err &&
581
582 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
583 git -C clone-any-http cat-file --batch-check <oids &&
t/t5562-http-backend-content-length.sh
+1 -1
@@ -163,7 +163,7 @@ test_expect_success 'CONTENT_LENGTH overflow ssite_t' '
163 REQUEST_METHOD=POST \
164 CONTENT_LENGTH="$NOT_FIT_IN_SSIZE" \
165 git http-backend </dev/null >/dev/null 2>err &&
166 - grep "fatal:.*CONTENT_LENGTH" err
166 + test_grep "fatal:.*CONTENT_LENGTH" err
167 '
168
169 test_expect_success 'empty CONTENT_LENGTH' '
t/t5564-http-proxy.sh
+5 -5
@@ -20,14 +20,14 @@ setup_askpass_helper
20 test_expect_success 'proxy requires password' '
21 test_config_global http.proxy $HTTPD_DEST &&
22 test_must_fail git clone $HTTPD_URL/smart/repo.git 2>err &&
23 - grep "error.*407" err
23 + test_grep "error.*407" err
24 '
25
26 test_expect_success 'clone through proxy with auth' '
27 test_when_finished "rm -rf clone" &&
28 test_config_global http.proxy http://proxuser:proxpass@$HTTPD_DEST &&
29 GIT_TRACE_CURL=$PWD/trace git clone $HTTPD_URL/smart/repo.git clone &&
30 - grep -i "Proxy-Authorization: Basic <redacted>" trace
30 + test_grep -i "Proxy-Authorization: Basic <redacted>" trace
31 '
32
33 test_expect_success 'clone can prompt for proxy password' '
@@ -82,7 +82,7 @@ test_expect_success SOCKS_PROXY 'clone via Unix socket' '
82 GIT_TRACE_CURL=$PWD/trace \
83 GIT_TRACE_CURL_COMPONENTS=socks \
84 git clone "$HTTPD_URL/smart/repo.git" clone 2>err &&
85 - grep -i "SOCKS4 request granted" trace
85 + test_grep -i "SOCKS4 request granted" trace
86 } ||
87 old_libcurl_error err
88 }
@@ -90,14 +90,14 @@ test_expect_success SOCKS_PROXY 'clone via Unix socket' '
90
91 test_expect_success 'Unix socket requires socks*:' - <<\EOT
92 ! git clone -c http.proxy=localhost/path https://example.com/repo.git 2>err && {
93 - grep -Fx "fatal: Invalid proxy URL 'localhost/path': only SOCKS proxies support paths" err ||
93 + test_grep -Fx "fatal: Invalid proxy URL 'localhost/path': only SOCKS proxies support paths" err ||
94 old_libcurl_error err
95 }
96 EOT
97
98 test_expect_success 'Unix socket requires localhost' - <<\EOT
99 ! git clone -c http.proxy=socks4://127.0.0.1/path https://example.com/repo.git 2>err && {
100 - grep -Fx "fatal: Invalid proxy URL 'socks4://127.0.0.1/path': host must be localhost if a path is present" err ||
100 + test_grep -Fx "fatal: Invalid proxy URL 'socks4://127.0.0.1/path': host must be localhost if a path is present" err ||
101 old_libcurl_error err
102 }
103 EOT
t/t5581-http-curl-verbose.sh
+1 -1
@@ -23,7 +23,7 @@ test_expect_success 'failure in git-upload-pack is shown' '
23 test_might_fail env GIT_CURL_VERBOSE=1 \
24 git clone "$HTTPD_URL/error_git_upload_pack/smart/repo.git" \
25 2>curl_log &&
26 - grep "<= Recv header: HTTP/1.1 500 Intentional Breakage" curl_log
26 + test_grep "<= Recv header: HTTP/1.1 500 Intentional Breakage" curl_log
27 '
28
29 test_done
t/t5583-push-branches.sh
+4 -4
@@ -60,21 +60,21 @@ test_expect_success '--all or --branches can not be combined with refspecs' '
60 test_must_fail git push remote-1 --all main >actual.all 2>&1 &&
61 test_must_fail git push remote-1 --branches main >actual.branches 2>&1 &&
62 test_cmp actual.all actual.branches &&
63 - grep "be combined with refspecs" actual.all
63 + test_grep "be combined with refspecs" actual.all
64 '
65
66 test_expect_success '--all or --branches can not be combined with --mirror' '
67 test_must_fail git push remote-1 --all --mirror >actual.all 2>&1 &&
68 test_must_fail git push remote-1 --branches --mirror >actual.branches 2>&1 &&
69 test_cmp actual.all actual.branches &&
70 - grep "cannot be used together" actual.all
70 + test_grep "cannot be used together" actual.all
71 '
72
73 test_expect_success '--all or --branches can not be combined with --tags' '
74 test_must_fail git push remote-1 --all --tags >actual.all 2>&1 &&
75 test_must_fail git push remote-1 --branches --tags >actual.branches 2>&1 &&
76 test_cmp actual.all actual.branches &&
77 - grep "cannot be used together" actual.all
77 + test_grep "cannot be used together" actual.all
78 '
79
80
@@ -82,7 +82,7 @@ test_expect_success '--all or --branches can not be combined with --delete' '
82 test_must_fail git push remote-1 --all --delete >actual.all 2>&1 &&
83 test_must_fail git push remote-1 --branches --delete >actual.branches 2>&1 &&
84 test_cmp actual.all actual.branches &&
85 - grep "cannot be used together" actual.all
85 + test_grep "cannot be used together" actual.all
86 '
87
88 test_expect_success '--all or --branches combines with --follow-tags have same behavior' '
t/t5601-clone.sh
+14 -14
@@ -159,8 +159,8 @@ test_expect_success 'clone --mirror does not repeat tags' '
159 git clone --mirror src mirror2 &&
160 (cd mirror2 &&
161 git show-ref 2> clone.err > clone.out) &&
162 - ! grep Duplicate mirror2/clone.err &&
163 - grep some-tag mirror2/clone.out
162 + test_grep ! Duplicate mirror2/clone.err &&
163 + test_grep some-tag mirror2/clone.out
164
165 '
166
@@ -224,12 +224,12 @@ test_expect_success 'clone a void' '
224 cd src-0 && git init
225 ) &&
226 git clone "file://$(pwd)/src-0" target-6 2>err-6 &&
227 - ! grep "fatal:" err-6 &&
227 + test_grep ! "fatal:" err-6 &&
228 (
229 cd src-0 && test_commit A
230 ) &&
231 git clone "file://$(pwd)/src-0" target-7 2>err-7 &&
232 - ! grep "fatal:" err-7 &&
232 + test_grep ! "fatal:" err-7 &&
233 # There is no reason to insist they are bit-for-bit
234 # identical, but this test should suffice for now.
235 test_cmp target-6/.git/config target-7/.git/config
@@ -298,22 +298,22 @@ test_expect_success 'clone separate gitdir where target already exists' '
298 rm -rf dst &&
299 echo foo=bar >>realgitdir/config &&
300 test_must_fail git clone --separate-git-dir realgitdir src dst &&
301 - grep foo=bar realgitdir/config
301 + test_grep foo=bar realgitdir/config
302 '
303
304 test_expect_success 'clone --reference from original' '
305 git clone --shared --bare src src-1 &&
306 git clone --bare src src-2 &&
307 git clone --reference=src-2 --bare src-1 target-8 &&
308 - grep /src-2/ target-8/objects/info/alternates
308 + test_grep /src-2/ target-8/objects/info/alternates
309 '
310
311 test_expect_success 'clone with more than one --reference' '
312 git clone --bare src src-3 &&
313 git clone --bare src src-4 &&
314 git clone --reference=src-3 --reference=src-4 src target-9 &&
315 - grep /src-3/ target-9/.git/objects/info/alternates &&
316 - grep /src-4/ target-9/.git/objects/info/alternates
315 + test_grep /src-3/ target-9/.git/objects/info/alternates &&
316 + test_grep /src-4/ target-9/.git/objects/info/alternates
317 '
318
319 test_expect_success 'clone from original with relative alternate' '
@@ -321,7 +321,7 @@ test_expect_success 'clone from original with relative alternate' '
321 git clone --bare src nest/src-5 &&
322 echo ../../../src/.git/objects >nest/src-5/objects/info/alternates &&
323 git clone --bare nest/src-5 target-10 &&
324 - grep /src/\\.git/objects target-10/objects/info/alternates
324 + test_grep /src/\\.git/objects target-10/objects/info/alternates
325 '
326
327 test_expect_success 'clone checking out a tag' '
@@ -663,8 +663,8 @@ test_expect_success PERL_TEST_HELPERS 'clone on case-insensitive fs' '
663 '
664
665 test_expect_success PERL_TEST_HELPERS,CASE_INSENSITIVE_FS 'colliding file detection' '
666 - grep X icasefs/warning &&
667 - grep x icasefs/warning &&
666 + test_grep X icasefs/warning &&
667 + test_grep x icasefs/warning &&
668 test_grep "the following paths have collided" icasefs/warning
669 '
670
@@ -857,7 +857,7 @@ test_expect_success 'auto-discover bundle URI from HTTP clone' '
857 cat >pattern <<-EOF &&
858 "event":"child_start".*"argv":\["git-remote-https","$HTTPD_URL/everything.bundle"\]
859 EOF
860 - grep -f pattern trace.txt
860 + test_grep -f pattern trace.txt
861 '
862
863 test_expect_success 'auto-discover multiple bundles from HTTP clone' '
@@ -888,11 +888,11 @@ test_expect_success 'auto-discover multiple bundles from HTTP clone' '
888 cat >pattern <<-EOF &&
889 "event":"child_start".*"argv":\["git-remote-https","$HTTPD_URL/everything.bundle"\]
890 EOF
891 - grep -f pattern trace.txt &&
891 + test_grep -f pattern trace.txt &&
892 cat >pattern <<-EOF &&
893 "event":"child_start".*"argv":\["git-remote-https","$HTTPD_URL/new.bundle"\]
894 EOF
895 - grep -f pattern trace.txt
895 + test_grep -f pattern trace.txt
896 '
897
898 test_expect_success 'auto-discover multiple bundles from HTTP clone: creationToken heuristic' '
t/t5604-clone-reference.sh
+4 -4
@@ -65,7 +65,7 @@ test_expect_success 'cloning with reference (no -l -s)' '
65
66 test_expect_success 'fetched no objects' '
67 test -s "$U.D" &&
68 - ! grep " want" "$U.D"
68 + test_grep ! " want" "$U.D"
69 '
70
71 test_expect_success 'existence of info/alternates' '
@@ -157,9 +157,9 @@ test_expect_success 'fetch with incomplete alternates' '
157 ) &&
158 main_object=$(git -C A rev-parse --verify refs/heads/main) &&
159 test -s "$U.K" &&
160 - ! grep " want $main_object" "$U.K" &&
160 + test_grep ! " want $main_object" "$U.K" &&
161 tag_object=$(git -C A rev-parse --verify refs/tags/foo) &&
162 - ! grep " want $tag_object" "$U.K"
162 + test_grep ! " want $tag_object" "$U.K"
163 '
164
165 test_expect_success 'clone using repo with gitfile as a reference' '
@@ -357,7 +357,7 @@ test_expect_success SYMLINKS 'clone repo with symlinked objects directory' '
357 test_must_fail git clone --local malicious clone 2>err &&
358
359 test_path_is_missing clone &&
360 - grep "is a symlink, refusing to clone with --local" err
360 + test_grep "is a symlink, refusing to clone with --local" err
361 '
362
363 test_expect_success 'dissociate from repo with commit graph' '
t/t5605-clone-local.sh
+1 -1
@@ -172,7 +172,7 @@ test_expect_success REFFILES 'local clone from repo with corrupt refs fails grac
172 echo a >corrupt/.git/refs/heads/topic &&
173
174 test_must_fail git clone corrupt working 2>err &&
175 - grep "has neither a valid OID nor a target" err
175 + test_grep "has neither a valid OID nor a target" err
176 '
177
178 test_done
t/t5606-clone-options.sh
+3 -3
@@ -63,7 +63,7 @@ test_expect_success 'disallows --bundle-uri with shallow options' '
63 for option in --depth=1 --shallow-since=01-01-2000 --shallow-exclude=HEAD
64 do
65 test_must_fail git clone --bundle-uri=bundle $option from to 2>err &&
66 - grep "bundle-uri.* cannot be used together" err || return 1
66 + test_grep "bundle-uri.* cannot be used together" err || return 1
67 done
68 '
69
@@ -147,7 +147,7 @@ test_expect_success 'prefers --origin over -c config' '
147 test_expect_success 'redirected clone does not show progress' '
148
149 git clone "file://$(pwd)/parent" clone-redirected >out 2>err &&
150 - ! grep % err &&
150 + test_grep ! % err &&
151 test_grep ! "Checking connectivity" err
152
153 '
@@ -156,7 +156,7 @@ test_expect_success 'redirected clone -v does show progress' '
156
157 git clone --progress "file://$(pwd)/parent" clone-redirected-progress \
158 >out 2>err &&
159 - grep % err
159 + test_grep % err
160
161 '
162
t/t5612-clone-refspec.sh
+1 -1
@@ -97,7 +97,7 @@ test_expect_success 'by default no tags will be kept updated' '
97 test_expect_success 'clone with --no-tags' '
98 (
99 cd dir_all_no_tags &&
100 - grep tagOpt .git/config &&
100 + test_grep tagOpt .git/config &&
101 git fetch &&
102 git for-each-ref refs/tags >../actual
103 ) &&
t/t5616-partial-clone.sh
+30 -30
@@ -60,8 +60,8 @@ test_expect_success 'verify that .promisor file contains refs fetched' '
60 ls pc1/.git/objects/pack/pack-*.promisor >promisorlist &&
61 test_line_count = 1 promisorlist &&
62 git -C srv.bare rev-parse --verify HEAD >headhash &&
63 - grep "$(cat headhash) HEAD" $(cat promisorlist) &&
64 - grep "$(cat headhash) refs/heads/main" $(cat promisorlist)
63 + test_grep "$(cat headhash) HEAD" $(cat promisorlist) &&
64 + test_grep "$(cat headhash) refs/heads/main" $(cat promisorlist)
65 '
66
67 # checkout main to force dynamic object fetch of blobs at HEAD.
@@ -230,8 +230,8 @@ test_expect_success 'fetch --refetch triggers repacking' '
230 GIT_TRACE2_EVENT="$PWD/trace1.event" \
231 git -C pc1 fetch --refetch origin &&
232 test_subcommand git maintenance run --auto --no-quiet --no-detach <trace1.event &&
233 - grep \"param\":\"gc.autopacklimit\",\"value\":\"1\" trace1.event &&
234 - grep \"param\":\"maintenance.incremental-repack.auto\",\"value\":\"-1\" trace1.event &&
233 + test_grep \"param\":\"gc.autopacklimit\",\"value\":\"1\" trace1.event &&
234 + test_grep \"param\":\"maintenance.incremental-repack.auto\",\"value\":\"-1\" trace1.event &&
235
236 GIT_TRACE2_EVENT="$PWD/trace2.event" \
237 git -c protocol.version=0 \
@@ -239,8 +239,8 @@ test_expect_success 'fetch --refetch triggers repacking' '
239 -c maintenance.incremental-repack.auto=1234 \
240 -C pc1 fetch --refetch origin &&
241 test_subcommand git maintenance run --auto --no-quiet --no-detach <trace2.event &&
242 - grep \"param\":\"gc.autopacklimit\",\"value\":\"0\" trace2.event &&
243 - grep \"param\":\"maintenance.incremental-repack.auto\",\"value\":\"-1\" trace2.event &&
242 + test_grep \"param\":\"gc.autopacklimit\",\"value\":\"0\" trace2.event &&
243 + test_grep \"param\":\"maintenance.incremental-repack.auto\",\"value\":\"-1\" trace2.event &&
244
245 GIT_TRACE2_EVENT="$PWD/trace3.event" \
246 git -c protocol.version=0 \
@@ -248,8 +248,8 @@ test_expect_success 'fetch --refetch triggers repacking' '
248 -c maintenance.incremental-repack.auto=0 \
249 -C pc1 fetch --refetch origin &&
250 test_subcommand git maintenance run --auto --no-quiet --no-detach <trace3.event &&
251 - grep \"param\":\"gc.autopacklimit\",\"value\":\"1\" trace3.event &&
252 - grep \"param\":\"maintenance.incremental-repack.auto\",\"value\":\"0\" trace3.event
251 + test_grep \"param\":\"gc.autopacklimit\",\"value\":\"1\" trace3.event &&
252 + test_grep \"param\":\"maintenance.incremental-repack.auto\",\"value\":\"0\" trace3.event
253 '
254
255 test_expect_success 'partial clone with transfer.fsckobjects=1 works with submodules' '
@@ -284,7 +284,7 @@ test_expect_success 'partial clone with transfer.fsckobjects=1 uses index-pack -
284
285 GIT_TRACE="$(pwd)/trace" git -c transfer.fsckobjects=1 \
286 clone --filter="blob:none" "file://$(pwd)/src" dst &&
287 - grep "git index-pack.*--fsck-objects" trace
287 + test_grep "git index-pack.*--fsck-objects" trace
288 '
289
290 test_expect_success 'use fsck before and after manually fetching a missing subtree' '
@@ -312,7 +312,7 @@ test_expect_success 'use fsck before and after manually fetching a missing subtr
312
313 # Auto-fetch a tree with cat-file.
314 git -C dst cat-file -p $SUBTREE >tree_contents &&
315 - grep file.txt tree_contents &&
315 + test_grep file.txt tree_contents &&
316
317 # fsck still works after an auto-fetch of a tree.
318 git -C dst fsck &&
@@ -333,14 +333,14 @@ test_expect_success 'implicitly construct combine: filter with repeated flags' '
333 GIT_TRACE=$(pwd)/trace git clone --bare \
334 --filter=blob:none --filter=tree:1 \
335 "file://$(pwd)/srv.bare" pc2 &&
336 - grep "trace:.* git pack-objects .*--filter=combine:blob:none+tree:1" \
336 + test_grep "trace:.* git pack-objects .*--filter=combine:blob:none+tree:1" \
337 trace &&
338 git -C pc2 rev-list --objects --missing=allow-any HEAD >objects &&
339
340 # We should have gotten some root trees.
341 - grep " $" objects &&
341 + test_grep " $" objects &&
342 # Should not have gotten any non-root trees or blobs.
343 - ! grep " ." objects &&
343 + test_grep ! " ." objects &&
344
345 xargs -n 1 git -C pc2 cat-file -t <objects >types &&
346 sort -u types >unique_types.actual &&
@@ -409,7 +409,7 @@ test_expect_success 'partial clone fetches blobs pointed to by refs even if norm
409 git -C src tag myblob "$BLOB" &&
410
411 git clone --filter="blob:none" "file://$(pwd)/src" dst 2>err &&
412 - ! grep "does not point to a valid object" err &&
412 + test_grep ! "does not point to a valid object" err &&
413 git -C dst fsck
414 '
415
@@ -424,10 +424,10 @@ test_expect_success 'fetch what is specified on CLI even if already promised' '
424
425 git clone --bare --filter=blob:none "file://$(pwd)/src" dst.git &&
426 git -C dst.git rev-list --objects --quiet --missing=print HEAD >missing_before &&
427 - grep "?$(cat blob)" missing_before &&
427 + test_grep "?$(cat blob)" missing_before &&
428 git -C dst.git fetch origin $(cat blob) &&
429 git -C dst.git rev-list --objects --quiet --missing=print HEAD >missing_after &&
430 - ! grep "?$(cat blob)" missing_after
430 + test_grep ! "?$(cat blob)" missing_after
431 '
432
433 test_expect_success 'setup src repo for sparse filter' '
@@ -449,8 +449,8 @@ test_expect_success 'partial clone with sparse filter succeeds' '
449 (
450 cd dst.git &&
451 git rev-list --objects --missing=print HEAD >out &&
452 - grep "^$(git rev-parse HEAD:one.t)" out &&
453 - grep "^?$(git rev-parse HEAD:two.t)" out
452 + test_grep "^$(git rev-parse HEAD:one.t)" out &&
453 + test_grep "^?$(git rev-parse HEAD:two.t)" out
454 )
455 '
456
@@ -521,7 +521,7 @@ test_expect_success 'fetch lazy-fetches only to resolve deltas' '
521 # Verify the assumption that the client needed to fetch the delta base
522 # to resolve the delta.
523 git -C server rev-parse HEAD~1^{tree} >hash &&
524 - grep "want $(cat hash)" trace
524 + test_grep "want $(cat hash)" trace
525 '
526
527 test_expect_success 'fetch lazy-fetches only to resolve deltas, protocol v2' '
@@ -538,12 +538,12 @@ test_expect_success 'fetch lazy-fetches only to resolve deltas, protocol v2' '
538 fetch "file://$(pwd)/server" main &&
539
540 # Verify that protocol version 2 was used.
541 - grep "fetch< version 2" trace &&
541 + test_grep "fetch< version 2" trace &&
542
543 # Verify the assumption that the client needed to fetch the delta base
544 # to resolve the delta.
545 git -C server rev-parse HEAD~1^{tree} >hash &&
546 - grep "want $(cat hash)" trace
546 + test_grep "want $(cat hash)" trace
547 '
548
549 test_expect_success 'fetch does not lazy-fetch missing targets of its refs' '
@@ -563,7 +563,7 @@ test_expect_success 'fetch does not lazy-fetch missing targets of its refs' '
563 --no-tags --recurse-submodules=no \
564 origin refs/tags/bar &&
565 FOO_HASH=$(git -C server rev-parse foo) &&
566 - ! grep "want $FOO_HASH" trace
566 + test_grep ! "want $FOO_HASH" trace
567 '
568
569 # The following two tests must be in this order. It is important that
@@ -621,7 +621,7 @@ test_expect_success 'fetch from a partial clone, protocol v0' '
621 test_config -C client protocol.version 0 &&
622 test_commit -C client bar &&
623 GIT_TRACE_PACKET="$(pwd)/trace" git -C client fetch "file://$(pwd)/server" &&
624 - ! grep "version 2" trace
624 + test_grep ! "version 2" trace
625 '
626
627 test_expect_success 'fetch from a partial clone, protocol v2' '
@@ -640,7 +640,7 @@ test_expect_success 'fetch from a partial clone, protocol v2' '
640 test_config -C client protocol.version 2 &&
641 test_commit -C client bar &&
642 GIT_TRACE_PACKET="$(pwd)/trace" git -C client fetch "file://$(pwd)/server" &&
643 - grep "version 2" trace
643 + test_grep "version 2" trace
644 '
645
646 test_expect_success 'repack does not loosen promisor objects' '
@@ -648,7 +648,7 @@ test_expect_success 'repack does not loosen promisor objects' '
648 git clone --bare --filter=blob:none "file://$(pwd)/srv.bare" client &&
649 test_when_finished "rm -rf client trace" &&
650 GIT_TRACE2_PERF="$(pwd)/trace" git -C client repack -A -d &&
651 - grep "loosen_unused_packed_objects/loosened:0" trace
651 + test_grep "loosen_unused_packed_objects/loosened:0" trace
652 '
653
654 test_expect_success 'lazy-fetch in submodule succeeds' '
@@ -824,7 +824,7 @@ test_expect_success 'when partial cloning, tolerate server not sending target of
824 # Exercise to make sure it works.
825 git -c protocol.version=2 clone \
826 --filter=blob:none $HTTPD_URL/one_time_script/server repo 2> err &&
827 - ! grep "missing object referenced by" err &&
827 + test_grep ! "missing object referenced by" err &&
828
829 # Ensure that the one-time-script script was used.
830 ! test -e "$HTTPD_ROOT_PATH/one-time-script"
@@ -881,13 +881,13 @@ test_expect_success PERL_TEST_HELPERS 'tolerate server sending REF_DELTA against
881 # by any 3 nybbles, then the OID of the delta base.
882 printf "f.,..%s" $(intersperse "," <deltabase_missing) >want &&
883 hex_unpack <thin.pack | intersperse "," >have &&
884 - grep $(cat want) have &&
884 + test_grep $(cat want) have &&
885
886 # Ensure that the pack contains one delta against HEAD^:have.txt,
887 # similar to the above.
888 printf "f.,..%s" $(intersperse "," <deltabase_have) >want &&
889 hex_unpack <thin.pack | intersperse "," >have &&
890 - grep $(cat want) have &&
890 + test_grep $(cat want) have &&
891
892 replace_packfile thin.pack &&
893
@@ -901,8 +901,8 @@ test_expect_success PERL_TEST_HELPERS 'tolerate server sending REF_DELTA against
901
902 # Ensure that the missing delta base was directly fetched, but not the
903 # one that the client has.
904 - grep "want $(cat deltabase_missing)" trace &&
905 - ! grep "want $(cat deltabase_have)" trace &&
904 + test_grep "want $(cat deltabase_missing)" trace &&
905 + test_grep ! "want $(cat deltabase_have)" trace &&
906
907 # Ensure that the one-time-script script was used.
908 ! test -e "$HTTPD_ROOT_PATH/one-time-script"
t/t5619-clone-local-ambiguous-transport.sh
+1 -1
@@ -64,7 +64,7 @@ test_expect_success 'ambiguous transport does not lead to arbitrary file-inclusi
64 #
65 # This works for now, and if we ever fix the URL detection, it
66 # is OK to change this to detect the transport error.
67 - grep "protocol .* is not supported" err
67 + test_grep "protocol .* is not supported" err
68 '
69
70 test_done
t/t5620-backfill.sh
+6 -6
@@ -144,7 +144,7 @@ test_expect_success 'do partial clone 2, backfill min batch size' '
144 test_expect_success 'backfill --sparse without sparse-checkout fails' '
145 git init not-sparse &&
146 test_must_fail git -C not-sparse backfill --sparse 2>err &&
147 - grep "problem loading sparse-checkout" err
147 + test_grep "problem loading sparse-checkout" err
148 '
149
150 test_expect_success 'backfill --sparse' '
@@ -422,7 +422,7 @@ test_expect_success 'backfill range with include-edges enables fetch-free git-lo
422 -C backfill-log log -p HEAD~2..HEAD >log-output &&
423
424 # No promisor fetches should have been needed.
425 - ! grep "fetch_count" log-trace
425 + test_grep ! "fetch_count" log-trace
426 '
427
428 test_expect_success 'backfill range without include edges causes on-demand fetches in git-log' '
@@ -439,7 +439,7 @@ test_expect_success 'backfill range without include edges causes on-demand fetch
439 GIT_TRACE2_EVENT="$(pwd)/log-no-bdy-trace" git \
440 -C backfill-log-no-bdy log -p HEAD~2..HEAD >log-output &&
441
442 - grep "fetch_count" log-no-bdy-trace
442 + test_grep "fetch_count" log-no-bdy-trace
443 '
444
445 test_expect_success 'backfill range enables fetch-free replay' '
@@ -470,7 +470,7 @@ test_expect_success 'backfill range enables fetch-free replay' '
470 GIT_TRACE2_EVENT="$(pwd)/replay-trace" git -C replay-dest.git \
471 replay --onto main topic~1..topic >replay-out &&
472
473 - ! grep "fetch_count" replay-trace
473 + test_grep ! "fetch_count" replay-trace
474 '
475
476 test_expect_success 'backfill enables fetch-free merge' '
@@ -501,7 +501,7 @@ test_expect_success 'backfill enables fetch-free merge' '
501 GIT_TRACE2_EVENT="$(pwd)/merge-trace" git -C merge-dest \
502 merge origin/side -m "test merge" &&
503
504 - ! grep "fetch_count" merge-trace
504 + test_grep ! "fetch_count" merge-trace
505 '
506
507 . "$TEST_DIRECTORY"/lib-httpd.sh
@@ -530,7 +530,7 @@ test_expect_success 'backfilling over HTTP succeeds' '
530 awk "{print \$1;}" <rev-list-out >oids &&
531 GIT_TRACE2_EVENT="$(pwd)/walk-trace" git -C backfill-http \
532 cat-file --batch-check <oids >batch-out &&
533 - ! grep missing batch-out
533 + test_grep ! missing batch-out
534 '
535
536 # DO NOT add non-httpd-specific tests here, because the last part of this
t/t5700-protocol-v1.sh
+23 -23
@@ -33,9 +33,9 @@ test_expect_success 'clone with git:// using protocol v1' '
33 test_cmp expect actual &&
34
35 # Client requested to use protocol v1
36 - grep "clone> .*\\\0\\\0version=1\\\0$" log &&
36 + test_grep "clone> .*\\\0\\\0version=1\\\0$" log &&
37 # Server responded using protocol v1
38 - grep "clone< version 1" log
38 + test_grep "clone< version 1" log
39 '
40
41 test_expect_success 'fetch with git:// using protocol v1' '
@@ -49,9 +49,9 @@ test_expect_success 'fetch with git:// using protocol v1' '
49 test_cmp expect actual &&
50
51 # Client requested to use protocol v1
52 - grep "fetch> .*\\\0\\\0version=1\\\0$" log &&
52 + test_grep "fetch> .*\\\0\\\0version=1\\\0$" log &&
53 # Server responded using protocol v1
54 - grep "fetch< version 1" log
54 + test_grep "fetch< version 1" log
55 '
56
57 test_expect_success 'pull with git:// using protocol v1' '
@@ -63,9 +63,9 @@ test_expect_success 'pull with git:// using protocol v1' '
63 test_cmp expect actual &&
64
65 # Client requested to use protocol v1
66 - grep "fetch> .*\\\0\\\0version=1\\\0$" log &&
66 + test_grep "fetch> .*\\\0\\\0version=1\\\0$" log &&
67 # Server responded using protocol v1
68 - grep "fetch< version 1" log
68 + test_grep "fetch< version 1" log
69 '
70
71 test_expect_success 'push with git:// using protocol v1' '
@@ -81,9 +81,9 @@ test_expect_success 'push with git:// using protocol v1' '
81 test_cmp expect actual &&
82
83 # Client requested to use protocol v1
84 - grep "push> .*\\\0\\\0version=1\\\0$" log &&
84 + test_grep "push> .*\\\0\\\0version=1\\\0$" log &&
85 # Server responded using protocol v1
86 - grep "push< version 1" log
86 + test_grep "push< version 1" log
87 '
88
89 stop_git_daemon
@@ -104,7 +104,7 @@ test_expect_success 'clone with file:// using protocol v1' '
104 test_cmp expect actual &&
105
106 # Server responded using protocol v1
107 - grep "clone< version 1" log
107 + test_grep "clone< version 1" log
108 '
109
110 test_expect_success 'fetch with file:// using protocol v1' '
@@ -118,7 +118,7 @@ test_expect_success 'fetch with file:// using protocol v1' '
118 test_cmp expect actual &&
119
120 # Server responded using protocol v1
121 - grep "fetch< version 1" log
121 + test_grep "fetch< version 1" log
122 '
123
124 test_expect_success 'pull with file:// using protocol v1' '
@@ -130,7 +130,7 @@ test_expect_success 'pull with file:// using protocol v1' '
130 test_cmp expect actual &&
131
132 # Server responded using protocol v1
133 - grep "fetch< version 1" log
133 + test_grep "fetch< version 1" log
134 '
135
136 test_expect_success 'push with file:// using protocol v1' '
@@ -146,7 +146,7 @@ test_expect_success 'push with file:// using protocol v1' '
146 test_cmp expect actual &&
147
148 # Server responded using protocol v1
149 - grep "push< version 1" log
149 + test_grep "push< version 1" log
150 '
151
152 test_expect_success 'cloning branchless tagless but not refless remote' '
@@ -196,7 +196,7 @@ test_expect_success 'clone with ssh:// using protocol v1' '
196 test_cmp expect actual &&
197
198 # Server responded using protocol v1
199 - grep "clone< version 1" log
199 + test_grep "clone< version 1" log
200 '
201
202 test_expect_success 'fetch with ssh:// using protocol v1' '
@@ -211,7 +211,7 @@ test_expect_success 'fetch with ssh:// using protocol v1' '
211 test_cmp expect actual &&
212
213 # Server responded using protocol v1
214 - grep "fetch< version 1" log
214 + test_grep "fetch< version 1" log
215 '
216
217 test_expect_success 'pull with ssh:// using protocol v1' '
@@ -224,7 +224,7 @@ test_expect_success 'pull with ssh:// using protocol v1' '
224 test_cmp expect actual &&
225
226 # Server responded using protocol v1
227 - grep "fetch< version 1" log
227 + test_grep "fetch< version 1" log
228 '
229
230 test_expect_success 'push with ssh:// using protocol v1' '
@@ -241,7 +241,7 @@ test_expect_success 'push with ssh:// using protocol v1' '
241 test_cmp expect actual &&
242
243 # Server responded using protocol v1
244 - grep "push< version 1" log
244 + test_grep "push< version 1" log
245 '
246
247 test_expect_success 'clone propagates object-format from empty repo' '
@@ -277,9 +277,9 @@ test_expect_success 'clone with http:// using protocol v1' '
277 test_cmp expect actual &&
278
279 # Client requested to use protocol v1
280 - grep "Git-Protocol: version=1" log &&
280 + test_grep "Git-Protocol: version=1" log &&
281 # Server responded using protocol v1
282 - grep "git< version 1" log
282 + test_grep "git< version 1" log
283 '
284
285 test_expect_success 'clone with http:// using protocol v1 with empty SHA-256 repo' '
@@ -291,9 +291,9 @@ test_expect_success 'clone with http:// using protocol v1 with empty SHA-256 rep
291 test_cmp expect actual &&
292
293 # Client requested to use protocol v1
294 - grep "Git-Protocol: version=1" log &&
294 + test_grep "Git-Protocol: version=1" log &&
295 # Server responded using protocol v1
296 - grep "git< version 1" log
296 + test_grep "git< version 1" log
297 '
298
299 test_expect_success 'fetch with http:// using protocol v1' '
@@ -307,7 +307,7 @@ test_expect_success 'fetch with http:// using protocol v1' '
307 test_cmp expect actual &&
308
309 # Server responded using protocol v1
310 - grep "git< version 1" log
310 + test_grep "git< version 1" log
311 '
312
313 test_expect_success 'pull with http:// using protocol v1' '
@@ -319,7 +319,7 @@ test_expect_success 'pull with http:// using protocol v1' '
319 test_cmp expect actual &&
320
321 # Server responded using protocol v1
322 - grep "git< version 1" log
322 + test_grep "git< version 1" log
323 '
324
325 test_expect_success 'push with http:// using protocol v1' '
@@ -335,7 +335,7 @@ test_expect_success 'push with http:// using protocol v1' '
335 test_cmp expect actual &&
336
337 # Server responded using protocol v1
338 - grep "git< version 1" log
338 + test_grep "git< version 1" log
339 '
340
341 # DO NOT add non-httpd-specific tests here, because the last part of this
t/t5701-git-serve.sh
+7 -7
@@ -97,7 +97,7 @@ test_expect_success 'request capability as command' '
97 0000
98 EOF
99 test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
100 - grep invalid.command.*agent err
100 + test_grep invalid.command.*agent err
101 '
102
103 test_expect_success 'request command as capability' '
@@ -108,7 +108,7 @@ test_expect_success 'request command as capability' '
108 0000
109 EOF
110 test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
111 - grep unknown.capability err
111 + test_grep unknown.capability err
112 '
113
114 test_expect_success 'requested command is command=value' '
@@ -118,7 +118,7 @@ test_expect_success 'requested command is command=value' '
118 0000
119 EOF
120 test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
121 - grep invalid.command.*ls-refs=whatever err
121 + test_grep invalid.command.*ls-refs=whatever err
122 '
123
124 test_expect_success 'wrong object-format' '
@@ -175,7 +175,7 @@ test_expect_success 'ls-refs complains about unknown options' '
175 EOF
176
177 test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
178 - grep unexpected.line.*no-such-arg err
178 + test_grep unexpected.line.*no-such-arg err
179 '
180
181 test_expect_success 'basic ref-prefixes' '
@@ -334,7 +334,7 @@ test_expect_success 'unexpected lines are not allowed in fetch request' '
334 cd server &&
335 test_must_fail test-tool serve-v2 --stateless-rpc
336 ) <in >/dev/null 2>err &&
337 - grep "unexpected line: .this-is-not-a-command." err
337 + test_grep "unexpected line: .this-is-not-a-command." err
338 '
339
340 # Test the basics of object-info
@@ -410,7 +410,7 @@ test_expect_success 'object-info missing from capabilities when disabled' '
410 --advertise-capabilities >out &&
411 test-tool pkt-line unpack <out >actual &&
412
413 - ! grep object.info actual
413 + test_grep ! object.info actual
414 '
415
416 test_expect_success 'object-info commands rejected when disabled' '
@@ -421,7 +421,7 @@ test_expect_success 'object-info commands rejected when disabled' '
421 EOF
422
423 test_must_fail test-tool serve-v2 --stateless-rpc <in 2>err &&
424 - grep invalid.command err
424 + test_grep invalid.command err
425 '
426
427 test_done
t/t5702-protocol-v2.sh
+77 -77
@@ -27,9 +27,9 @@ test_expect_success 'list refs with git:// using protocol v2' '
27 ls-remote --symref "$GIT_DAEMON_URL/parent" >actual &&
28
29 # Client requested to use protocol v2
30 - grep "ls-remote> .*\\\0\\\0version=2\\\0$" log &&
30 + test_grep "ls-remote> .*\\\0\\\0version=2\\\0$" log &&
31 # Server responded using protocol v2
32 - grep "ls-remote< version 2" log &&
32 + test_grep "ls-remote< version 2" log &&
33
34 git ls-remote --symref "$GIT_DAEMON_URL/parent" >expect &&
35 test_cmp expect actual
@@ -59,9 +59,9 @@ test_expect_success 'clone with git:// using protocol v2' '
59 test_cmp expect actual &&
60
61 # Client requested to use protocol v2
62 - grep "clone> .*\\\0\\\0version=2\\\0$" log &&
62 + test_grep "clone> .*\\\0\\\0version=2\\\0$" log &&
63 # Server responded using protocol v2
64 - grep "clone< version 2" log
64 + test_grep "clone< version 2" log
65 '
66
67 test_expect_success 'fetch with git:// using protocol v2' '
@@ -77,9 +77,9 @@ test_expect_success 'fetch with git:// using protocol v2' '
77 test_cmp expect actual &&
78
79 # Client requested to use protocol v2
80 - grep "fetch> .*\\\0\\\0version=2\\\0$" log &&
80 + test_grep "fetch> .*\\\0\\\0version=2\\\0$" log &&
81 # Server responded using protocol v2
82 - grep "fetch< version 2" log
82 + test_grep "fetch< version 2" log
83 '
84
85 test_expect_success 'fetch by hash without tag following with protocol v2 does not list refs' '
@@ -91,8 +91,8 @@ test_expect_success 'fetch by hash without tag following with protocol v2 does n
91 GIT_TRACE_PACKET="$(pwd)/log" git -C daemon_child -c protocol.version=2 \
92 fetch --no-tags origin $(cat two_a_hash) &&
93
94 - grep "fetch< version 2" log &&
95 - ! grep "fetch> command=ls-refs" log
94 + test_grep "fetch< version 2" log &&
95 + test_grep ! "fetch> command=ls-refs" log
96 '
97
98 test_expect_success 'pull with git:// using protocol v2' '
@@ -106,9 +106,9 @@ test_expect_success 'pull with git:// using protocol v2' '
106 test_cmp expect actual &&
107
108 # Client requested to use protocol v2
109 - grep "fetch> .*\\\0\\\0version=2\\\0$" log &&
109 + test_grep "fetch> .*\\\0\\\0version=2\\\0$" log &&
110 # Server responded using protocol v2
111 - grep "fetch< version 2" log
111 + test_grep "fetch< version 2" log
112 '
113
114 test_expect_success 'push with git:// and a config of v2 does not request v2' '
@@ -130,9 +130,9 @@ test_expect_success 'push with git:// and a config of v2 does not request v2' '
130 test_cmp expect actual &&
131
132 # Client requested to use protocol v2
133 - ! grep "push> .*\\\0\\\0version=2\\\0$" log &&
133 + test_grep ! "push> .*\\\0\\\0version=2\\\0$" log &&
134 # Server responded using protocol v2
135 - ! grep "push< version 2" log
135 + test_grep ! "push< version 2" log
136 '
137
138 stop_git_daemon
@@ -151,7 +151,7 @@ test_expect_success 'list refs with file:// using protocol v2' '
151 ls-remote --symref "file://$(pwd)/file_parent" >actual &&
152
153 # Server responded using protocol v2
154 - grep "ls-remote< version 2" log &&
154 + test_grep "ls-remote< version 2" log &&
155
156 git ls-remote --symref "file://$(pwd)/file_parent" >expect &&
157 test_cmp expect actual
@@ -181,8 +181,8 @@ test_expect_success 'server-options are sent when using ls-remote' '
181 EOF
182
183 test_cmp expect actual &&
184 - grep "server-option=hello" log &&
185 - grep "server-option=world" log
184 + test_grep "server-option=hello" log &&
185 + test_grep "server-option=world" log
186 '
187
188 test_expect_success 'server-options from configuration are used by ls-remote' '
@@ -241,12 +241,12 @@ test_expect_success 'clone with file:// using protocol v2' '
241 test_cmp expect actual &&
242
243 # Server responded using protocol v2
244 - grep "clone< version 2" log &&
244 + test_grep "clone< version 2" log &&
245
246 # Client sent ref-prefixes to filter the ref-advertisement
247 - grep "ref-prefix HEAD" log &&
248 - grep "ref-prefix refs/heads/" log &&
249 - grep "ref-prefix refs/tags/" log
247 + test_grep "ref-prefix HEAD" log &&
248 + test_grep "ref-prefix refs/heads/" log &&
249 + test_grep "ref-prefix refs/tags/" log
250 '
251
252 test_expect_success 'clone of empty repo propagates name of default branch' '
@@ -311,7 +311,7 @@ test_expect_success 'clone propagates unborn HEAD from non-empty repo' '
311 echo "refs/heads/mydefaultbranch" >expect &&
312 git -C file_unborn_child symbolic-ref HEAD >actual &&
313 test_cmp expect actual &&
314 - grep "warning: remote HEAD refers to nonexistent ref" stderr
314 + test_grep "warning: remote HEAD refers to nonexistent ref" stderr
315 '
316
317 test_expect_success 'clone propagates object-format from empty repo' '
@@ -343,7 +343,7 @@ test_expect_success 'bare clone propagates unborn HEAD from non-empty repo' '
343 echo "refs/heads/mydefaultbranch" >expect &&
344 git -C file_unborn_child.git symbolic-ref HEAD >actual &&
345 test_cmp expect actual &&
346 - ! grep "warning:" stderr
346 + test_grep ! "warning:" stderr
347 '
348
349 test_expect_success 'defaulted HEAD uses remote branch if available' '
@@ -366,7 +366,7 @@ test_expect_success 'defaulted HEAD uses remote branch if available' '
366 git -C file_unborn_child symbolic-ref HEAD >actual &&
367 test_cmp expect actual &&
368 test_path_is_file file_unborn_child/stuff.t &&
369 - ! grep "warning:" stderr
369 + test_grep ! "warning:" stderr
370 '
371
372 test_expect_success 'fetch with file:// using protocol v2' '
@@ -382,7 +382,7 @@ test_expect_success 'fetch with file:// using protocol v2' '
382 test_cmp expect actual &&
383
384 # Server responded using protocol v2
385 - grep "fetch< version 2" log
385 + test_grep "fetch< version 2" log
386 '
387
388 test_expect_success 'ref advertisement is filtered during fetch using protocol v2' '
@@ -398,8 +398,8 @@ test_expect_success 'ref advertisement is filtered during fetch using protocol v
398 git -C file_parent log -1 --format=%s >expect &&
399 test_cmp expect actual &&
400
401 - grep "refs/heads/main" log &&
402 - ! grep "refs/heads/unwanted-branch" log
401 + test_grep "refs/heads/main" log &&
402 + test_grep ! "refs/heads/unwanted-branch" log
403 '
404
405 test_expect_success 'server-options are sent when fetching' '
@@ -414,8 +414,8 @@ test_expect_success 'server-options are sent when fetching' '
414 git -C file_parent log -1 --format=%s >expect &&
415 test_cmp expect actual &&
416
417 - grep "server-option=hello" log &&
418 - grep "server-option=world" log
417 + test_grep "server-option=hello" log &&
418 + test_grep "server-option=world" log
419 '
420
421 test_expect_success 'server-options are sent when fetch multiple remotes' '
@@ -485,8 +485,8 @@ test_expect_success 'server-options are sent when cloning' '
485 clone --server-option=hello --server-option=world \
486 "file://$(pwd)/file_parent" myclone &&
487
488 - grep "server-option=hello" log &&
489 - grep "server-option=world" log
488 + test_grep "server-option=hello" log &&
489 + test_grep "server-option=world" log
490 '
491
492 test_expect_success 'server-options from configuration are used by git-clone' '
@@ -578,12 +578,12 @@ test_expect_success 'setup filter tests' '
578 test_expect_success 'partial clone' '
579 GIT_TRACE_PACKET="$(pwd)/trace" git -c protocol.version=2 \
580 clone --filter=blob:none "file://$(pwd)/server" client &&
581 - grep "version 2" trace &&
581 + test_grep "version 2" trace &&
582
583 # Ensure that the old version of the file is missing
584 git -C client rev-list --quiet --objects --missing=print main \
585 >observed.oids &&
586 - grep "$(git -C server rev-parse message1:a.txt)" observed.oids &&
586 + test_grep "$(git -C server rev-parse message1:a.txt)" observed.oids &&
587
588 # Ensure that client passes fsck
589 git -C client fsck
@@ -593,11 +593,11 @@ test_expect_success 'dynamically fetch missing object' '
593 rm "$(pwd)/trace" &&
594 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
595 cat-file -p $(git -C server rev-parse message1:a.txt) &&
596 - grep "version 2" trace
596 + test_grep "version 2" trace
597 '
598
599 test_expect_success 'when dynamically fetching missing object, do not list refs' '
600 - ! grep "git> command=ls-refs" trace
600 + test_grep ! "git> command=ls-refs" trace
601 '
602
603 test_expect_success 'partial fetch' '
@@ -607,12 +607,12 @@ test_expect_success 'partial fetch' '
607
608 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
609 fetch --filter=blob:none "$SERVER" main:refs/heads/other &&
610 - grep "version 2" trace &&
610 + test_grep "version 2" trace &&
611
612 # Ensure that the old version of the file is missing
613 git -C client rev-list --quiet --objects --missing=print other \
614 >observed.oids &&
615 - grep "$(git -C server rev-parse message1:a.txt)" observed.oids &&
615 + test_grep "$(git -C server rev-parse message1:a.txt)" observed.oids &&
616
617 # Ensure that client passes fsck
618 git -C client fsck
@@ -625,14 +625,14 @@ test_expect_success 'do not advertise filter if not configured to do so' '
625 git -C server config uploadpack.allowfilter 1 &&
626 GIT_TRACE_PACKET="$(pwd)/trace" git -c protocol.version=2 \
627 ls-remote "$SERVER" &&
628 - grep "fetch=.*filter" trace &&
628 + test_grep "fetch=.*filter" trace &&
629
630 rm "$(pwd)/trace" &&
631 git -C server config uploadpack.allowfilter 0 &&
632 GIT_TRACE_PACKET="$(pwd)/trace" git -c protocol.version=2 \
633 ls-remote "$SERVER" &&
634 grep "fetch=" trace >fetch_capabilities &&
635 - ! grep filter fetch_capabilities
635 + test_grep ! filter fetch_capabilities
636 '
637
638 test_expect_success 'partial clone warns if filter is not advertised' '
@@ -658,7 +658,7 @@ test_expect_success 'even with handcrafted request, filter does not work if not
658
659 test_must_fail test-tool -C server serve-v2 --stateless-rpc \
660 <in >/dev/null 2>err &&
661 - grep "unexpected line: .filter blob:none." err &&
661 + test_grep "unexpected line: .filter blob:none." err &&
662
663 # Exercise to ensure that if advertised, filter works
664 git -C server config uploadpack.allowfilter 1 &&
@@ -675,8 +675,8 @@ test_expect_success 'default refspec is used to filter ref when fetching' '
675 git -C file_parent log -1 --format=%s three >expect &&
676 test_cmp expect actual &&
677
678 - grep "ref-prefix refs/heads/" log &&
679 - grep "ref-prefix refs/tags/" log
678 + test_grep "ref-prefix refs/heads/" log &&
679 + test_grep "ref-prefix refs/tags/" log
680 '
681
682 test_expect_success 'set up parent for prefix tests' '
@@ -750,9 +750,9 @@ test_expect_success 'fetch supports various ways of have lines' '
750 "$(git -C server rev-parse fetch-by-sha1)" &&
751
752 # Ensure that the appropriate prefixes are sent (using a sample)
753 - grep "fetch> ref-prefix dwim" trace &&
754 - grep "fetch> ref-prefix refs/heads/dwim" trace &&
755 - grep "fetch> ref-prefix refs/tags/prefix" trace &&
753 + test_grep "fetch> ref-prefix dwim" trace &&
754 + test_grep "fetch> ref-prefix refs/heads/dwim" trace &&
755 + test_grep "fetch> ref-prefix refs/tags/prefix" trace &&
756
757 # Ensure that the correct objects are returned
758 git -C client cat-file -e $(git -C server rev-parse dwim) &&
@@ -779,9 +779,9 @@ test_expect_success 'fetch supports include-tag and tag following' '
779 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
780 fetch "$(pwd)/server" to_fetch:to_fetch &&
781
782 - grep "fetch> ref-prefix to_fetch" trace &&
783 - grep "fetch> ref-prefix refs/tags/" trace &&
784 - grep "fetch> include-tag" trace &&
782 + test_grep "fetch> ref-prefix to_fetch" trace &&
783 + test_grep "fetch> ref-prefix refs/tags/" trace &&
784 + test_grep "fetch> include-tag" trace &&
785
786 git -C client cat-file -e $(git -C client rev-parse annotated_tag)
787 '
@@ -805,7 +805,7 @@ test_expect_success 'upload-pack respects client shallows' '
805 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
806 fetch origin newbranch &&
807 # Ensure that protocol v2 is used
808 - grep "fetch< version 2" trace
808 + test_grep "fetch< version 2" trace
809 '
810
811 test_expect_success 'ensure that multiple fetches in same process from a shallow repo works' '
@@ -823,7 +823,7 @@ test_expect_success 'ensure that multiple fetches in same process from a shallow
823 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
824 fetch --shallow-exclude one origin &&
825 # Ensure that protocol v2 is used
826 - grep "fetch< version 2" trace
826 + test_grep "fetch< version 2" trace
827 '
828
829 test_expect_success 'deepen-relative' '
@@ -844,7 +844,7 @@ test_expect_success 'deepen-relative' '
844 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
845 fetch --deepen=1 origin &&
846 # Ensure that protocol v2 is used
847 - grep "fetch< version 2" trace &&
847 + test_grep "fetch< version 2" trace &&
848
849 git -C client log --pretty=tformat:%s origin/main >actual &&
850 cat >expected <<-\EOF &&
@@ -909,7 +909,7 @@ test_expect_success 'file:// --negotiate-only' '
909 --negotiation-tip=$(git -C client rev-parse HEAD) \
910 origin >out &&
911 COMMON=$(git -C "$SERVER" rev-parse two) &&
912 - grep "$COMMON" out
912 + test_grep "$COMMON" out
913 '
914
915 test_expect_success 'file:// --negotiate-only with protocol v0' '
@@ -932,7 +932,7 @@ test_expect_success 'push with custom path does not request v2' '
932 --receive-pack="env >../env.trace; git-receive-pack" \
933 origin HEAD:refs/heads/custom-push-test &&
934 test_path_is_file env.trace &&
935 - ! grep ^GIT_PROTOCOL env.trace
935 + test_grep ! ^GIT_PROTOCOL env.trace
936 '
937
938 test_expect_success 'fetch with custom path does request v2' '
@@ -940,7 +940,7 @@ test_expect_success 'fetch with custom path does request v2' '
940 git -C client fetch \
941 --upload-pack="env >../env.trace; git-upload-pack" \
942 origin HEAD &&
943 - grep ^GIT_PROTOCOL=version=2 env.trace
943 + test_grep ^GIT_PROTOCOL=version=2 env.trace
944 '
945
946 test_expect_success 'archive with custom path does not request v2' '
@@ -950,7 +950,7 @@ test_expect_success 'archive with custom path does not request v2' '
950 --remote=origin \
951 HEAD >/dev/null &&
952 test_path_is_file env.trace &&
953 - ! grep ^GIT_PROTOCOL env.trace
953 + test_grep ! ^GIT_PROTOCOL env.trace
954 '
955
956 test_expect_success 'reject client packfile-uris if not advertised' '
@@ -994,11 +994,11 @@ test_expect_success 'clone with http:// using protocol v2' '
994 test_cmp expect actual &&
995
996 # Client requested to use protocol v2
997 - grep "Git-Protocol: version=2" log &&
997 + test_grep "Git-Protocol: version=2" log &&
998 # Server responded using protocol v2
999 - grep "git< version 2" log &&
999 + test_grep "git< version 2" log &&
1000 # Verify that the chunked encoding sending codepath is NOT exercised
1001 - ! grep "Send header: Transfer-Encoding: chunked" log
1001 + test_grep ! "Send header: Transfer-Encoding: chunked" log
1002 '
1003
1004 test_expect_success 'clone repository with http:// using protocol v2 with incomplete pktline length' '
@@ -1011,9 +1011,9 @@ test_expect_success 'clone repository with http:// using protocol v2 with incomp
1011 clone "$HTTPD_URL/smart/incomplete_length" incomplete_length_child 2>err &&
1012
1013 # Client requested to use protocol v2
1014 - grep "Git-Protocol: version=2" log &&
1014 + test_grep "Git-Protocol: version=2" log &&
1015 # Server responded using protocol v2
1016 - grep "git< version 2" log &&
1016 + test_grep "git< version 2" log &&
1017 # Client reported appropriate failure
1018 test_grep "bytes of length header were received" err
1019 '
@@ -1028,9 +1028,9 @@ test_expect_success 'clone repository with http:// using protocol v2 with incomp
1028 clone "$HTTPD_URL/smart/incomplete_body" incomplete_body_child 2>err &&
1029
1030 # Client requested to use protocol v2
1031 - grep "Git-Protocol: version=2" log &&
1031 + test_grep "Git-Protocol: version=2" log &&
1032 # Server responded using protocol v2
1033 - grep "git< version 2" log &&
1033 + test_grep "git< version 2" log &&
1034 # Client reported appropriate failure
1035 test_grep "bytes of body are still expected" err
1036 '
@@ -1043,9 +1043,9 @@ test_expect_success 'clone with http:// using protocol v2 and invalid parameters
1043 clone --shallow-since=20151012 "$HTTPD_URL/smart/http_parent" http_child_invalid &&
1044
1045 # Client requested to use protocol v2
1046 - grep "Git-Protocol: version=2" log &&
1046 + test_grep "Git-Protocol: version=2" log &&
1047 # Server responded using protocol v2
1048 - grep "git< version 2" log
1048 + test_grep "git< version 2" log
1049 '
1050
1051 test_expect_success 'clone big repository with http:// using protocol v2' '
@@ -1070,11 +1070,11 @@ test_expect_success 'clone big repository with http:// using protocol v2' '
1070 clone "$HTTPD_URL/smart/big" big_child &&
1071
1072 # Client requested to use protocol v2
1073 - grep "Git-Protocol: version=2" log &&
1073 + test_grep "Git-Protocol: version=2" log &&
1074 # Server responded using protocol v2
1075 - grep "git< version 2" log &&
1075 + test_grep "git< version 2" log &&
1076 # Verify that the chunked encoding sending codepath is exercised
1077 - grep "Send header: Transfer-Encoding: chunked" log
1077 + test_grep "Send header: Transfer-Encoding: chunked" log
1078 '
1079
1080 test_expect_success 'fetch with http:// using protocol v2' '
@@ -1090,7 +1090,7 @@ test_expect_success 'fetch with http:// using protocol v2' '
1090 test_cmp expect actual &&
1091
1092 # Server responded using protocol v2
1093 - grep "git< version 2" log
1093 + test_grep "git< version 2" log
1094 '
1095
1096 test_expect_success 'fetch with http:// by hash without tag following with protocol v2 does not list refs' '
@@ -1102,8 +1102,8 @@ test_expect_success 'fetch with http:// by hash without tag following with proto
1102 GIT_TRACE_PACKET="$(pwd)/log" git -C http_child -c protocol.version=2 \
1103 fetch --no-tags origin $(cat two_a_hash) &&
1104
1105 - grep "fetch< version 2" log &&
1106 - ! grep "fetch> command=ls-refs" log
1105 + test_grep "fetch< version 2" log &&
1106 + test_grep ! "fetch> command=ls-refs" log
1107 '
1108
1109 test_expect_success 'fetch from namespaced repo respects namespaces' '
@@ -1120,7 +1120,7 @@ test_expect_success 'fetch from namespaced repo respects namespaces' '
1120 refs/heads/main:refs/heads/theirs &&
1121
1122 # Server responded using protocol v2
1123 - grep "fetch< version 2" log &&
1123 + test_grep "fetch< version 2" log &&
1124
1125 git -C "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" rev-parse one >expect &&
1126 git -C http_child rev-parse theirs >actual &&
@@ -1157,9 +1157,9 @@ test_expect_success 'push with http:// and a config of v2 does not request v2' '
1157 test_cmp expect actual &&
1158
1159 # Client did not request to use protocol v2
1160 - ! grep "Git-Protocol: version=2" log &&
1160 + test_grep ! "Git-Protocol: version=2" log &&
1161 # Server did not respond using protocol v2
1162 - ! grep "git< version 2" log
1162 + test_grep ! "git< version 2" log
1163 '
1164
1165 test_expect_success 'when server sends "ready", expect DELIM' '
@@ -1207,8 +1207,8 @@ test_expect_success 'when server does not send "ready", expect FLUSH' '
1207 test_must_fail env GIT_TRACE_PACKET="$(pwd)/log" git -C http_child \
1208 -c protocol.version=2 \
1209 fetch "$HTTPD_URL/one_time_script/http_parent" 2> err &&
1210 - grep "fetch< .*acknowledgments" log &&
1211 - ! grep "fetch< .*ready" log &&
1210 + test_grep "fetch< .*acknowledgments" log &&
1211 + test_grep ! "fetch< .*ready" log &&
1212 test_grep "expected no other sections to be sent after no .ready." err
1213 '
1214
@@ -1247,7 +1247,7 @@ test_expect_success 'part of packfile response provided as URI' '
1247 do
1248 git verify-pack --object-format=$(test_oid algo) --verbose $idx >out &&
1249 {
1250 - grep -E "^[0-9a-f]{16,} " out || :
1250 + grep -E "^[0-9a-f]{16,} " out || : # lint-ok: data filter
1251 } >out.objectlist &&
1252 if test_line_count = 1 out.objectlist
1253 then
@@ -1446,7 +1446,7 @@ test_expect_success 'packfile-uri path redacted in trace' '
1446 -c fetch.uriprotocols=http,https \
1447 clone "$HTTPD_URL/smart/http_parent" http_child &&
1448
1449 - grep -F "clone< \\1$(cat packh) $HTTPD_URL/<redacted>" log
1449 + test_grep -F "clone< \\1$(cat packh) $HTTPD_URL/<redacted>" log
1450 '
1451
1452 test_expect_success 'packfile-uri path not redacted in trace when GIT_TRACE_REDACT=0' '
@@ -1472,7 +1472,7 @@ test_expect_success 'packfile-uri path not redacted in trace when GIT_TRACE_REDA
1472 -c fetch.uriprotocols=http,https \
1473 clone "$HTTPD_URL/smart/http_parent" http_child &&
1474
1475 - grep -F "clone< \\1$(cat packh) $HTTPD_URL/dumb/mypack-$(cat packh).pack" log
1475 + test_grep -F "clone< \\1$(cat packh) $HTTPD_URL/dumb/mypack-$(cat packh).pack" log
1476 '
1477
1478 test_expect_success 'http:// --negotiate-only' '
@@ -1487,7 +1487,7 @@ test_expect_success 'http:// --negotiate-only' '
1487 --negotiation-tip=$(git -C client rev-parse HEAD) \
1488 origin >out &&
1489 COMMON=$(git -C "$SERVER" rev-parse two) &&
1490 - grep "$COMMON" out
1490 + test_grep "$COMMON" out
1491 '
1492
1493 test_expect_success 'http:// --negotiate-only without wait-for-done support' '
t/t5703-upload-pack-ref-in-want.sh
+11 -11
@@ -101,7 +101,7 @@ test_expect_success 'invalid want-ref line' '
101
102 test-tool pkt-line pack <pkt >in &&
103 test_must_fail test-tool serve-v2 --stateless-rpc 2>out <in &&
104 - grep "unknown ref" out
104 + test_grep "unknown ref" out
105 '
106
107 test_expect_success 'basic want-ref' '
@@ -235,11 +235,11 @@ test_expect_success 'fetching with exact OID' '
235 git -C local fetch origin \
236 "$oid":refs/heads/actual &&
237
238 - grep \"key\":\"total_rounds\",\"value\":\"2\" trace2 &&
238 + test_grep \"key\":\"total_rounds\",\"value\":\"2\" trace2 &&
239 git -C "$REPO" rev-parse "d" >expected &&
240 git -C local rev-parse refs/heads/actual >actual &&
241 test_cmp expected actual &&
242 - grep "want $oid" log
242 + test_grep "want $oid" log
243 '
244
245 test_expect_success 'fetching multiple refs' '
@@ -252,8 +252,8 @@ test_expect_success 'fetching multiple refs' '
252 git -C "$REPO" rev-parse "main" "baz" >expected &&
253 git -C local rev-parse refs/remotes/origin/main refs/remotes/origin/baz >actual &&
254 test_cmp expected actual &&
255 - grep "want-ref refs/heads/main" log &&
256 - grep "want-ref refs/heads/baz" log
255 + test_grep "want-ref refs/heads/main" log &&
256 + test_grep "want-ref refs/heads/baz" log
257 '
258
259 test_expect_success 'fetching ref and exact OID' '
@@ -268,8 +268,8 @@ test_expect_success 'fetching ref and exact OID' '
268 git -C "$REPO" rev-parse "main" "b" >expected &&
269 git -C local rev-parse refs/remotes/origin/main refs/heads/actual >actual &&
270 test_cmp expected actual &&
271 - grep "want $oid" log &&
272 - grep "want-ref refs/heads/main" log
271 + test_grep "want $oid" log &&
272 + test_grep "want-ref refs/heads/main" log
273 '
274
275 test_expect_success 'fetching with wildcard that does not match any refs' '
@@ -291,8 +291,8 @@ test_expect_success 'fetching with wildcard that matches multiple refs' '
291 git -C "$REPO" rev-parse "o/foo" "o/bar" >expected &&
292 git -C local rev-parse "o/foo" "o/bar" >actual &&
293 test_cmp expected actual &&
294 - grep "want-ref refs/heads/o/foo" log &&
295 - grep "want-ref refs/heads/o/bar" log
294 + test_grep "want-ref refs/heads/o/foo" log &&
295 + test_grep "want-ref refs/heads/o/bar" log
296 '
297
298 REPO="$(pwd)/repo-ns"
@@ -345,7 +345,7 @@ test_expect_success 'with namespace: want-ref outside namespace is unknown' '
345
346 test_must_fail env GIT_NAMESPACE=ns \
347 test-tool -C "$REPO" serve-v2 --stateless-rpc >out <in &&
348 - grep "unknown ref" out
348 + test_grep "unknown ref" out
349 '
350
351 # Cross-check refs/heads/ns-no indeed exists
@@ -381,7 +381,7 @@ test_expect_success 'with namespace: hideRefs is matched, relative to namespace'
381
382 test_must_fail env GIT_NAMESPACE=ns \
383 test-tool -C "$REPO" serve-v2 --stateless-rpc >out <in &&
384 - grep "unknown ref" out
384 + test_grep "unknown ref" out
385 '
386
387 # Cross-check refs/heads/hidden indeed exists
t/t5705-session-id-in-capabilities.sh
+6 -6
@@ -55,8 +55,8 @@ do
55 git -c protocol.version=$PROTO -C local fetch \
56 --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \
57 origin &&
58 - grep \"key\":\"server-sid\" tr2-client-events &&
59 - grep \"key\":\"client-sid\" tr2-server-events
58 + test_grep \"key\":\"server-sid\" tr2-client-events &&
59 + test_grep \"key\":\"client-sid\" tr2-server-events
60 '
61
62 test_expect_success "session IDs advertised (push v${PROTO})" '
@@ -68,8 +68,8 @@ do
68 git -c protocol.version=$PROTO -C local push \
69 --receive-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-receive-pack" \
70 origin HEAD:new-branch &&
71 - grep \"key\":\"server-sid\" tr2-client-events &&
72 - grep \"key\":\"client-sid\" tr2-server-events
71 + test_grep \"key\":\"server-sid\" tr2-client-events &&
72 + test_grep \"key\":\"client-sid\" tr2-server-events
73 '
74
75 test_expect_success "client & server log negotiated version (v${PROTO})" '
@@ -79,8 +79,8 @@ do
79 git -c protocol.version=$PROTO -C local fetch \
80 --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \
81 origin &&
82 - grep \"key\":\"negotiated-version\",\"value\":\"$PROTO\" tr2-client-events &&
83 - grep \"key\":\"negotiated-version\",\"value\":\"$PROTO\" tr2-server-events
82 + test_grep \"key\":\"negotiated-version\",\"value\":\"$PROTO\" tr2-client-events &&
83 + test_grep \"key\":\"negotiated-version\",\"value\":\"$PROTO\" tr2-server-events
84 '
85 done
86
t/t5750-bundle-uri-parse.sh
+4 -4
@@ -78,7 +78,7 @@ test_expect_success 'bundle_uri_parse_line(): relative URIs and parent paths' '
78 # now until the interface for relative_url() allows for reporting
79 # an error instead of die()ing.
80 test_must_fail test-tool bundle-uri parse-key-values in >actual 2>err &&
81 - grep "fatal: cannot strip one component off url" err
81 + test_grep "fatal: cannot strip one component off url" err
82 '
83
84 test_expect_success 'bundle_uri_parse_line() parsing edge cases: empty key or value' '
@@ -283,7 +283,7 @@ test_expect_success 'parse config format edge cases: creationToken heuristic' '
283 EOF
284
285 test-tool bundle-uri parse-config expect >actual 2>err &&
286 - grep "could not parse bundle list key creationToken with value '\''bogus'\''" err
286 + test_grep "could not parse bundle list key creationToken with value '\''bogus'\''" err
287 '
288
289 test_expect_success 'parse config format: bundle with missing uri' '
@@ -296,7 +296,7 @@ test_expect_success 'parse config format: bundle with missing uri' '
296 EOF
297
298 test_must_fail test-tool bundle-uri parse-config input 2>err &&
299 - grep "bundle '\''missing-uri'\'' has no uri" err
299 + test_grep "bundle '\''missing-uri'\'' has no uri" err
300 '
301
302 test_expect_success 'parse config format: bundle with url instead of uri' '
@@ -309,7 +309,7 @@ test_expect_success 'parse config format: bundle with url instead of uri' '
309 EOF
310
311 test_must_fail test-tool bundle-uri parse-config input 2>err &&
312 - grep "bundle '\''typo'\'' has no uri" err
312 + test_grep "bundle '\''typo'\'' has no uri" err
313 '
314
315 test_done
t/t5801-remote-helpers.sh
+2 -2
@@ -306,7 +306,7 @@ test_expect_success 'push messages' '
306 echo new >>file &&
307 git commit -a -m new &&
308 git push origin new_branch 2> msg &&
309 - ! grep "\[new branch\]" msg
309 + test_grep ! "\[new branch\]" msg
310 )
311 '
312
@@ -352,7 +352,7 @@ test_expect_success 'totally broken helper reports failure message' '
352 test_must_fail \
353 env PATH="$PWD:$PATH" \
354 git clone broken://example.com/foo.git 2>stderr &&
355 - grep aborted stderr
355 + test_grep aborted stderr
356 '
357
358 test_done
t/t5810-proto-disable-local.sh
+1 -1
@@ -28,7 +28,7 @@ test_expect_success 'setup repo with dash' '
28 test_expect_success 'repo names starting with dash are rejected' '
29 rm -f trace.out &&
30 test_must_fail env GIT_TRACE="$PWD/trace.out" git fetch -- -repo.git &&
31 - ! grep upload-pack trace.out
31 + test_grep ! upload-pack trace.out
32 '
33
34 test_expect_success 'full paths still work' '
t/t5813-proto-disable-ssh.sh
+2 -2
@@ -24,7 +24,7 @@ test_proto "git+ssh://" ssh "git+ssh://remote$PWD/remote/repo.git"
24 # simply confirm from its output that it did not run at all.
25 test_expect_success 'hostnames starting with dash are rejected' '
26 test_must_fail git clone ssh://-remote/repo.git dash-host 2>stderr &&
27 - ! grep ^ssh: stderr
27 + test_grep ! ^ssh: stderr
28 '
29
30 test_expect_success 'setup repo with dash' '
@@ -34,7 +34,7 @@ test_expect_success 'setup repo with dash' '
34
35 test_expect_success 'repo names starting with dash are rejected' '
36 test_must_fail git clone remote:-repo.git dash-path 2>stderr &&
37 - ! grep ^ssh: stderr
37 + test_grep ! ^ssh: stderr
38 '
39
40 test_expect_success 'full paths still work' '
t/t6000-rev-list-misc.sh
+13 -13
@@ -17,8 +17,8 @@ test_expect_success setup '
17
18 test_expect_success 'rev-list --objects heeds pathspecs' '
19 git rev-list --objects HEAD -- wanted_file >output &&
20 - grep wanted_file output &&
21 - ! grep unwanted_file output
20 + test_grep wanted_file output &&
21 + test_grep ! unwanted_file output
22 '
23
24 test_expect_success 'rev-list --objects with pathspecs and deeper paths' '
@@ -29,11 +29,11 @@ test_expect_success 'rev-list --objects with pathspecs and deeper paths' '
29 git commit -m two &&
30
31 git rev-list --objects HEAD -- foo >output &&
32 - grep foo/file output &&
32 + test_grep foo/file output &&
33
34 git rev-list --objects HEAD -- foo/file >output &&
35 - grep foo/file output &&
36 - ! grep unwanted_file output
35 + test_grep foo/file output &&
36 + test_grep ! unwanted_file output
37 '
38
39 test_expect_success 'rev-list --objects with pathspecs and copied files' '
@@ -49,28 +49,28 @@ test_expect_success 'rev-list --objects with pathspecs and copied files' '
49
50 ONE=$(git rev-parse HEAD:one) &&
51 git rev-list --objects HEAD two >output &&
52 - grep "$ONE two/three" output &&
53 - ! grep one output
52 + test_grep "$ONE two/three" output &&
53 + test_grep ! one output
54 '
55
56 test_expect_success 'rev-list --objects --no-object-names has no space/names' '
57 git rev-list --objects --no-object-names HEAD >output &&
58 - ! grep wanted_file output &&
59 - ! grep unwanted_file output &&
60 - ! grep " " output
58 + test_grep ! wanted_file output &&
59 + test_grep ! unwanted_file output &&
60 + test_grep ! " " output
61 '
62
63 test_expect_success 'rev-list --objects --no-object-names works with cat-file' '
64 git rev-list --objects --no-object-names --all >list-output &&
65 git cat-file --batch-check <list-output >cat-output &&
66 - ! grep missing cat-output
66 + test_grep ! missing cat-output
67 '
68
69 test_expect_success '--no-object-names and --object-names are last-one-wins' '
70 git rev-list --objects --no-object-names --object-names --all >output &&
71 - grep wanted_file output &&
71 + test_grep wanted_file output &&
72 git rev-list --objects --object-names --no-object-names --all >output &&
73 - ! grep wanted_file output
73 + test_grep ! wanted_file output
74 '
75
76 test_expect_success 'rev-list A..B and rev-list ^A B are the same' '
t/t6005-rev-list-count.sh
+4 -4
@@ -18,7 +18,7 @@ test_expect_success 'no options' '
18
19 test_expect_success '--max-count' '
20 test_must_fail git rev-list --max-count=1q HEAD 2>error &&
21 - grep "not an integer" error &&
21 + test_grep "not an integer" error &&
22
23 test_stdout_line_count = 0 git rev-list HEAD --max-count=0 &&
24 test_stdout_line_count = 3 git rev-list HEAD --max-count=3 &&
@@ -29,10 +29,10 @@ test_expect_success '--max-count' '
29
30 test_expect_success '--max-count all forms' '
31 test_must_fail git rev-list -1q HEAD 2>error &&
32 - grep "not an integer" error &&
32 + test_grep "not an integer" error &&
33 test_must_fail git rev-list --1 HEAD &&
34 test_must_fail git rev-list -n 1q HEAD 2>error &&
35 - grep "not an integer" error &&
35 + test_grep "not an integer" error &&
36
37 test_stdout_line_count = 1 git rev-list HEAD --max-count=1 &&
38 test_stdout_line_count = 1 git rev-list HEAD -1 &&
@@ -43,7 +43,7 @@ test_expect_success '--max-count all forms' '
43
44 test_expect_success '--skip' '
45 test_must_fail git rev-list --skip 1q HEAD 2>error &&
46 - grep "not an integer" error &&
46 + test_grep "not an integer" error &&
47
48 test_stdout_line_count = 5 git rev-list HEAD --skip=0 &&
49 test_stdout_line_count = 2 git rev-list HEAD --skip=3 &&
t/t6006-rev-list-format.sh
+2 -2
@@ -537,7 +537,7 @@ test_expect_success 'del LF before empty (1)' '
537 test_expect_success 'del LF before empty (2)' '
538 git show -s --pretty=format:"%s%n%-b%nThanks%n" HEAD >actual &&
539 test_line_count = 6 actual &&
540 - grep "^$" actual
540 + test_grep "^$" actual
541 '
542
543 test_expect_success 'add LF before non-empty (1)' '
@@ -548,7 +548,7 @@ test_expect_success 'add LF before non-empty (1)' '
548 test_expect_success 'add LF before non-empty (2)' '
549 git show -s --pretty=format:"%s%+b%nThanks%n" HEAD >actual &&
550 test_line_count = 6 actual &&
551 - grep "^$" actual
551 + test_grep "^$" actual
552 '
553
554 test_expect_success 'add SP before non-empty (1)' '
t/t6009-rev-list-parent.sh
+2 -2
@@ -64,10 +64,10 @@ test_expect_success 'setup roots, merges and octopuses' '
64
65 test_expect_success 'parse --max-parents & --min-parents' '
66 test_must_fail git rev-list --max-parents=1q HEAD 2>error &&
67 - grep "not an integer" error &&
67 + test_grep "not an integer" error &&
68
69 test_must_fail git rev-list --min-parents=1q HEAD 2>error &&
70 - grep "not an integer" error &&
70 + test_grep "not an integer" error &&
71
72 git rev-list --max-parents=1 --min-parents=1 HEAD &&
73 git rev-list --max-parents=-1 --min-parents=-1 HEAD
t/t6020-bundle-misc.sh
+6 -6
@@ -612,7 +612,7 @@ test_expect_success 'cloning from filtered bundle has useful error' '
612 --all \
613 --filter=blob:none &&
614 test_must_fail git clone --bare partial.bdl partial 2>err &&
615 - grep "cannot clone from filtered bundle" err
615 + test_grep "cannot clone from filtered bundle" err
616 '
617
618 test_expect_success 'verify catches unreachable, broken prerequisites' '
@@ -644,13 +644,13 @@ test_expect_success 'verify catches unreachable, broken prerequisites' '
644 # Verify should fail
645 test_must_fail git bundle verify \
646 ../clone-from/tip.bundle 2>err &&
647 - grep "some prerequisite commits .* are not connected" err &&
647 + test_grep "some prerequisite commits .* are not connected" err &&
648 test_line_count = 1 err &&
649
650 # Unbundling should fail
651 test_must_fail git bundle unbundle \
652 ../clone-from/tip.bundle 2>err &&
653 - grep "some prerequisite commits .* are not connected" err &&
653 + test_grep "some prerequisite commits .* are not connected" err &&
654 test_line_count = 1 err
655 )
656 '
@@ -658,7 +658,7 @@ test_expect_success 'verify catches unreachable, broken prerequisites' '
658 test_expect_success 'bundle progress includes write phase' '
659 GIT_PROGRESS_DELAY=0 \
660 git bundle create --progress out.bundle --all 2>err &&
661 - grep 'Writing' err
661 + test_grep 'Writing' err
662 '
663
664 test_expect_success TTY 'create --quiet disables all bundle progress' '
@@ -670,7 +670,7 @@ test_expect_success TTY 'create --quiet disables all bundle progress' '
670 test_expect_success 'bundle progress with --no-quiet' '
671 GIT_PROGRESS_DELAY=0 \
672 git bundle create --no-quiet out.bundle --all 2>err &&
673 - grep "%" err
673 + test_grep "%" err
674 '
675
676 test_expect_success 'create bundle with duplicate refnames' '
@@ -730,7 +730,7 @@ test_expect_success 'read bundle over stdin' '
730 git bundle create some.bundle HEAD &&
731
732 git bundle verify - <some.bundle 2>err &&
733 - grep "<stdin> is okay" err &&
733 + test_grep "<stdin> is okay" err &&
734
735 git bundle list-heads some.bundle >expect &&
736 git bundle list-heads - <some.bundle >actual &&
t/t6022-rev-list-missing.sh
+2 -2
@@ -68,7 +68,7 @@ do
68 allow-any)
69 ;;
70 print)
71 - grep ?$oid actual.raw &&
71 + test_grep ?$oid actual.raw &&
72 echo ?$oid >>expect.raw
73 ;;
74 esac &&
@@ -132,7 +132,7 @@ do
132 allow-any)
133 ;;
134 print)
135 - grep ?$oid actual.raw &&
135 + test_grep ?$oid actual.raw &&
136 echo ?$oid >>expect.raw
137 ;;
138 esac &&
t/t6030-bisect-porcelain.sh
+75 -75
@@ -118,8 +118,8 @@ test_expect_success 'bisect fails if given any junk instead of revs' '
118 test_expect_success 'bisect start without -- takes unknown arg as pathspec' '
119 git bisect reset &&
120 git bisect start foo bar &&
121 - grep foo ".git/BISECT_NAMES" &&
122 - grep bar ".git/BISECT_NAMES"
121 + test_grep foo ".git/BISECT_NAMES" &&
122 + test_grep bar ".git/BISECT_NAMES"
123 '
124
125 test_expect_success 'bisect reset: back in a branch checked out also elsewhere' '
@@ -258,7 +258,7 @@ test_expect_success 'bisect skip: successful result' '
258 git bisect start $HASH4 $HASH1 &&
259 git bisect skip &&
260 git bisect bad > my_bisect_log.txt &&
261 - grep "$HASH2 is the first '\''bad'\'' commit" my_bisect_log.txt
261 + test_grep "$HASH2 is the first '\''bad'\'' commit" my_bisect_log.txt
262 '
263
264 # $HASH1 is good, $HASH4 is bad, we skip $HASH3 and $HASH2
@@ -269,11 +269,11 @@ test_expect_success 'bisect skip: cannot tell between 3 commits' '
269 git bisect start $HASH4 $HASH1 &&
270 git bisect skip &&
271 test_expect_code 2 git bisect skip >my_bisect_log.txt &&
272 - grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt &&
273 - ! grep $HASH1 my_bisect_log.txt &&
274 - grep $HASH2 my_bisect_log.txt &&
275 - grep $HASH3 my_bisect_log.txt &&
276 - grep $HASH4 my_bisect_log.txt
272 + test_grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt &&
273 + test_grep ! $HASH1 my_bisect_log.txt &&
274 + test_grep $HASH2 my_bisect_log.txt &&
275 + test_grep $HASH3 my_bisect_log.txt &&
276 + test_grep $HASH4 my_bisect_log.txt
277 '
278
279 # $HASH1 is good, $HASH4 is bad, we skip $HASH3
@@ -285,11 +285,11 @@ test_expect_success 'bisect skip: cannot tell between 2 commits' '
285 git bisect start $HASH4 $HASH1 &&
286 git bisect skip &&
287 test_expect_code 2 git bisect good >my_bisect_log.txt &&
288 - grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt &&
289 - ! grep $HASH1 my_bisect_log.txt &&
290 - ! grep $HASH2 my_bisect_log.txt &&
291 - grep $HASH3 my_bisect_log.txt &&
292 - grep $HASH4 my_bisect_log.txt
288 + test_grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt &&
289 + test_grep ! $HASH1 my_bisect_log.txt &&
290 + test_grep ! $HASH2 my_bisect_log.txt &&
291 + test_grep $HASH3 my_bisect_log.txt &&
292 + test_grep $HASH4 my_bisect_log.txt
293 '
294
295 # $HASH1 is good, $HASH4 is both skipped and bad, we skip $HASH3
@@ -304,11 +304,11 @@ test_expect_success 'bisect skip: with commit both bad and skipped' '
304 git bisect good $HASH1 &&
305 git bisect skip &&
306 test_expect_code 2 git bisect good >my_bisect_log.txt &&
307 - grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt &&
308 - ! grep $HASH1 my_bisect_log.txt &&
309 - ! grep $HASH2 my_bisect_log.txt &&
310 - grep $HASH3 my_bisect_log.txt &&
311 - grep $HASH4 my_bisect_log.txt
307 + test_grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt &&
308 + test_grep ! $HASH1 my_bisect_log.txt &&
309 + test_grep ! $HASH2 my_bisect_log.txt &&
310 + test_grep $HASH3 my_bisect_log.txt &&
311 + test_grep $HASH4 my_bisect_log.txt
312 '
313
314 test_bisect_run_args () {
@@ -439,7 +439,7 @@ test_expect_success '"git bisect run" simple case' '
439 git bisect good $HASH1 &&
440 git bisect bad $HASH4 &&
441 git bisect run ./test_script.sh >my_bisect_log.txt &&
442 - grep "$HASH3 is the first '\''bad'\'' commit" my_bisect_log.txt &&
442 + test_grep "$HASH3 is the first '\''bad'\'' commit" my_bisect_log.txt &&
443 git bisect reset
444 '
445
@@ -449,7 +449,7 @@ test_expect_success '"git bisect run" simple case' '
449 git bisect good $HASH1 &&
450 git bisect bad $HASH4 &&
451 git bisect run printf "%s %s\n" reset --bisect-skip >my_bisect_log.txt &&
452 - grep -e "reset --bisect-skip" my_bisect_log.txt &&
452 + test_grep -e "reset --bisect-skip" my_bisect_log.txt &&
453 git bisect reset
454 '
455
@@ -461,7 +461,7 @@ test_expect_success '"git bisect run" with more complex "git bisect start"' '
461 EOF
462 git bisect start $HASH4 $HASH1 &&
463 git bisect run ./test_script.sh >my_bisect_log.txt &&
464 - grep "$HASH4 is the first '\''bad'\'' commit" my_bisect_log.txt &&
464 + test_grep "$HASH4 is the first '\''bad'\'' commit" my_bisect_log.txt &&
465 git bisect reset
466 '
467
@@ -474,7 +474,7 @@ test_expect_success 'bisect run accepts exit code 126 as bad' '
474 git bisect good $HASH1 &&
475 git bisect bad $HASH4 &&
476 git bisect run ./test_script.sh >my_bisect_log.txt &&
477 - grep "$HASH3 is the first '\''bad'\'' commit" my_bisect_log.txt
477 + test_grep "$HASH3 is the first '\''bad'\'' commit" my_bisect_log.txt
478 '
479
480 test_expect_success POSIXPERM 'bisect run fails with non-executable test script' '
@@ -485,7 +485,7 @@ test_expect_success POSIXPERM 'bisect run fails with non-executable test script'
485 git bisect good $HASH1 &&
486 git bisect bad $HASH4 &&
487 test_must_fail git bisect run ./not-executable.sh >my_bisect_log.txt &&
488 - ! grep "is the first '\''bad'\'' commit" my_bisect_log.txt
488 + test_grep ! "is the first '\''bad'\'' commit" my_bisect_log.txt
489 '
490
491 test_expect_success 'bisect run accepts exit code 127 as bad' '
@@ -497,7 +497,7 @@ test_expect_success 'bisect run accepts exit code 127 as bad' '
497 git bisect good $HASH1 &&
498 git bisect bad $HASH4 &&
499 git bisect run ./test_script.sh >my_bisect_log.txt &&
500 - grep "$HASH3 is the first '\''bad'\'' commit" my_bisect_log.txt
500 + test_grep "$HASH3 is the first '\''bad'\'' commit" my_bisect_log.txt
501 '
502
503 test_expect_success 'bisect run fails with missing test script' '
@@ -507,7 +507,7 @@ test_expect_success 'bisect run fails with missing test script' '
507 git bisect good $HASH1 &&
508 git bisect bad $HASH4 &&
509 test_must_fail git bisect run ./does-not-exist.sh >my_bisect_log.txt &&
510 - ! grep "is the first '\''bad'\'' commit" my_bisect_log.txt
510 + test_grep ! "is the first '\''bad'\'' commit" my_bisect_log.txt
511 '
512
513 # $HASH1 is good, $HASH5 is bad, we skip $HASH3
@@ -520,14 +520,14 @@ test_expect_success 'bisect skip: add line and then a new test' '
520 git bisect start $HASH5 $HASH1 &&
521 git bisect skip &&
522 git bisect good > my_bisect_log.txt &&
523 - grep "$HASH5 is the first '\''bad'\'' commit" my_bisect_log.txt &&
523 + test_grep "$HASH5 is the first '\''bad'\'' commit" my_bisect_log.txt &&
524 git bisect log > log_to_replay.txt &&
525 git bisect reset
526 '
527
528 test_expect_success 'bisect skip and bisect replay' '
529 git bisect replay log_to_replay.txt > my_bisect_log.txt &&
530 - grep "$HASH5 is the first '\''bad'\'' commit" my_bisect_log.txt &&
530 + test_grep "$HASH5 is the first '\''bad'\'' commit" my_bisect_log.txt &&
531 git bisect reset
532 '
533
@@ -541,11 +541,11 @@ test_expect_success 'bisect run & skip: cannot tell between 2' '
541 EOF
542 git bisect start $HASH6 $HASH1 &&
543 test_expect_code 2 git bisect run ./test_script.sh >my_bisect_log.txt &&
544 - grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt &&
545 - ! grep $HASH3 my_bisect_log.txt &&
546 - ! grep $HASH6 my_bisect_log.txt &&
547 - grep $HASH4 my_bisect_log.txt &&
548 - grep $HASH5 my_bisect_log.txt
544 + test_grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt &&
545 + test_grep ! $HASH3 my_bisect_log.txt &&
546 + test_grep ! $HASH6 my_bisect_log.txt &&
547 + test_grep $HASH4 my_bisect_log.txt &&
548 + test_grep $HASH5 my_bisect_log.txt
549 '
550
551 HASH7=
@@ -560,7 +560,7 @@ test_expect_success 'bisect run & skip: find first bad' '
560 EOF
561 git bisect start $HASH7 $HASH1 &&
562 git bisect run ./test_script.sh >my_bisect_log.txt &&
563 - grep "$HASH6 is the first '\''bad'\'' commit" my_bisect_log.txt
563 + test_grep "$HASH6 is the first '\''bad'\'' commit" my_bisect_log.txt
564 '
565
566 test_expect_success 'bisect skip only one range' '
@@ -569,7 +569,7 @@ test_expect_success 'bisect skip only one range' '
569 git bisect skip $HASH1..$HASH5 &&
570 test "$HASH6" = "$(git rev-parse --verify HEAD)" &&
571 test_must_fail git bisect bad > my_bisect_log.txt &&
572 - grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt
572 + test_grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt
573 '
574
575 test_expect_success 'bisect skip many ranges' '
@@ -578,7 +578,7 @@ test_expect_success 'bisect skip many ranges' '
578 git bisect skip $HASH2 $HASH2.. ..$HASH5 &&
579 test "$HASH6" = "$(git rev-parse --verify HEAD)" &&
580 test_must_fail git bisect bad > my_bisect_log.txt &&
581 - grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt
581 + test_grep "first '\''bad'\'' commit could be any of" my_bisect_log.txt
582 '
583
584 test_expect_success 'bisect starting with a detached HEAD' '
@@ -610,7 +610,7 @@ test_expect_success 'bisect does not create a "bisect" branch' '
610 rev_hash6=$(git rev-parse --verify HEAD) &&
611 test "$rev_hash6" = "$HASH6" &&
612 git bisect good > my_bisect_log.txt &&
613 - grep "$HASH7 is the first '\''bad'\'' commit" my_bisect_log.txt &&
613 + test_grep "$HASH7 is the first '\''bad'\'' commit" my_bisect_log.txt &&
614 git bisect reset &&
615 rev_hash6=$(git rev-parse --verify bisect) &&
616 test "$rev_hash6" = "$HASH6" &&
@@ -637,26 +637,26 @@ test_expect_success 'side branch creation' '
637 test_expect_success 'good merge base when good and bad are siblings' '
638 git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
639 test_grep "merge base must be tested" my_bisect_log.txt &&
640 - grep $HASH4 my_bisect_log.txt &&
640 + test_grep $HASH4 my_bisect_log.txt &&
641 git bisect good > my_bisect_log.txt &&
642 - ! grep "merge base must be tested" my_bisect_log.txt &&
643 - grep $HASH6 my_bisect_log.txt &&
642 + test_grep ! "merge base must be tested" my_bisect_log.txt &&
643 + test_grep $HASH6 my_bisect_log.txt &&
644 git bisect reset
645 '
646 test_expect_success 'skipped merge base when good and bad are siblings' '
647 git bisect start "$SIDE_HASH7" "$HASH7" > my_bisect_log.txt &&
648 test_grep "merge base must be tested" my_bisect_log.txt &&
649 - grep $HASH4 my_bisect_log.txt &&
649 + test_grep $HASH4 my_bisect_log.txt &&
650 git bisect skip > my_bisect_log.txt 2>&1 &&
651 - grep "warning" my_bisect_log.txt &&
652 - grep $SIDE_HASH6 my_bisect_log.txt &&
651 + test_grep "warning" my_bisect_log.txt &&
652 + test_grep $SIDE_HASH6 my_bisect_log.txt &&
653 git bisect reset
654 '
655
656 test_expect_success 'bad merge base when good and bad are siblings' '
657 git bisect start "$HASH7" HEAD > my_bisect_log.txt &&
658 test_grep "merge base must be tested" my_bisect_log.txt &&
659 - grep $HASH4 my_bisect_log.txt &&
659 + test_grep $HASH4 my_bisect_log.txt &&
660 test_must_fail git bisect bad > my_bisect_log.txt 2>&1 &&
661 test_grep "merge base $HASH4 is bad" my_bisect_log.txt &&
662 test_grep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt &&
@@ -686,8 +686,8 @@ test_expect_success 'many merge bases creation' '
686 B_HASH=$(git rev-parse --verify HEAD) &&
687 git merge-base --all "$A_HASH" "$B_HASH" > merge_bases.txt &&
688 test_line_count = 2 merge_bases.txt &&
689 - grep "$HASH5" merge_bases.txt &&
690 - grep "$SIDE_HASH5" merge_bases.txt
689 + test_grep "$HASH5" merge_bases.txt &&
690 + test_grep "$SIDE_HASH5" merge_bases.txt
691 '
692
693 # We want to automatically find the merge that
@@ -703,7 +703,7 @@ test_expect_success '"git bisect run --first-parent" simple case' '
703 git bisect good $HASH4 &&
704 git bisect bad $B_HASH &&
705 git bisect run ./test_script.sh >my_bisect_log.txt &&
706 - grep "$B_HASH is the first '\''bad'\'' commit" my_bisect_log.txt &&
706 + test_grep "$B_HASH is the first '\''bad'\'' commit" my_bisect_log.txt &&
707 git bisect reset &&
708 test_path_is_missing .git/BISECT_FIRST_PARENT
709 '
@@ -715,11 +715,11 @@ test_expect_success 'good merge bases when good and bad are siblings' '
715 test_grep "merge base must be tested" my_bisect_log2.txt &&
716 {
717 {
718 - grep "$SIDE_HASH5" my_bisect_log.txt &&
719 - grep "$HASH5" my_bisect_log2.txt
718 + test_grep "$SIDE_HASH5" my_bisect_log.txt &&
719 + test_grep "$HASH5" my_bisect_log2.txt
720 } || {
721 - grep "$SIDE_HASH5" my_bisect_log2.txt &&
722 - grep "$HASH5" my_bisect_log.txt
721 + test_grep "$SIDE_HASH5" my_bisect_log2.txt &&
722 + test_grep "$HASH5" my_bisect_log.txt
723 }
724 } &&
725 git bisect reset
@@ -728,7 +728,7 @@ test_expect_success 'good merge bases when good and bad are siblings' '
728 test_expect_success 'optimized merge base checks' '
729 git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
730 test_grep "merge base must be tested" my_bisect_log.txt &&
731 - grep "$HASH4" my_bisect_log.txt &&
731 + test_grep "$HASH4" my_bisect_log.txt &&
732 git bisect good > my_bisect_log2.txt &&
733 test -f ".git/BISECT_ANCESTORS_OK" &&
734 test "$HASH6" = $(git rev-parse --verify HEAD) &&
@@ -777,7 +777,7 @@ test_expect_success 'restricting bisection on one dir' '
777 para1=$(git rev-parse --verify HEAD) &&
778 test "$para1" = "$PARA_HASH1" &&
779 git bisect bad > my_bisect_log.txt &&
780 - grep "$PARA_HASH1 is the first '\''bad'\'' commit" my_bisect_log.txt
780 + test_grep "$PARA_HASH1 is the first '\''bad'\'' commit" my_bisect_log.txt
781 '
782
783 test_expect_success 'restricting bisection on one dir and a file' '
@@ -795,7 +795,7 @@ test_expect_success 'restricting bisection on one dir and a file' '
795 para1=$(git rev-parse --verify HEAD) &&
796 test "$para1" = "$PARA_HASH1" &&
797 git bisect good > my_bisect_log.txt &&
798 - grep "$PARA_HASH4 is the first '\''bad'\'' commit" my_bisect_log.txt
798 + test_grep "$PARA_HASH4 is the first '\''bad'\'' commit" my_bisect_log.txt
799 '
800
801 test_expect_success 'skipping away from skipped commit' '
@@ -826,7 +826,7 @@ test_expect_success 'test bisection on bare repo - --no-checkout specified' '
826 "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
827 >../nocheckout.log
828 ) &&
829 - grep "$HASH3 is the first '\''bad'\'' commit" nocheckout.log
829 + test_grep "$HASH3 is the first '\''bad'\'' commit" nocheckout.log
830 '
831
832
@@ -841,7 +841,7 @@ test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '
841 "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
842 >../defaulted.log
843 ) &&
844 - grep "$HASH3 is the first '\''bad'\'' commit" defaulted.log
844 + test_grep "$HASH3 is the first '\''bad'\'' commit" defaulted.log
845 '
846
847 #
@@ -1031,21 +1031,21 @@ test_expect_success 'bisect start with one new and old' '
1031 git bisect new $HASH4 &&
1032 git bisect new &&
1033 git bisect new >bisect_result &&
1034 - grep "$HASH2 is the first '\''new'\'' commit" bisect_result &&
1034 + test_grep "$HASH2 is the first '\''new'\'' commit" bisect_result &&
1035 git bisect log >log_to_replay.txt &&
1036 git bisect reset
1037 '
1038
1039 test_expect_success 'bisect replay with old and new' '
1040 git bisect replay log_to_replay.txt >bisect_result &&
1041 - grep "$HASH2 is the first '\''new'\'' commit" bisect_result &&
1041 + test_grep "$HASH2 is the first '\''new'\'' commit" bisect_result &&
1042 git bisect reset
1043 '
1044
1045 test_expect_success 'bisect replay with CRLF log' '
1046 append_cr <log_to_replay.txt >log_to_replay_crlf.txt &&
1047 git bisect replay log_to_replay_crlf.txt >bisect_result_crlf &&
1048 - grep "$HASH2 is the first '\''new'\'' commit" bisect_result_crlf &&
1048 + test_grep "$HASH2 is the first '\''new'\'' commit" bisect_result_crlf &&
1049 git bisect reset
1050 '
1051
@@ -1092,16 +1092,16 @@ test_expect_success 'bisect start with one term1 and term2' '
1092 test_expect_success 'bogus command does not start bisect' '
1093 git bisect reset &&
1094 test_must_fail git bisect --bisect-terms 1 2 2>out &&
1095 - ! grep "You need to start" out &&
1095 + test_grep ! "You need to start" out &&
1096 test_must_fail git bisect --bisect-terms 2>out &&
1097 - ! grep "You need to start" out &&
1098 - grep "git bisect.*visualize" out &&
1097 + test_grep ! "You need to start" out &&
1098 + test_grep "git bisect.*visualize" out &&
1099 git bisect reset
1100 '
1101
1102 test_expect_success 'bisect replay with term1 and term2' '
1103 git bisect replay log_to_replay.txt >bisect_result &&
1104 - grep "$HASH2 is the first '\''term1'\'' commit" bisect_result &&
1104 + test_grep "$HASH2 is the first '\''term1'\'' commit" bisect_result &&
1105 git bisect reset
1106 '
1107
@@ -1120,7 +1120,7 @@ test_expect_success 'bisect start term1 term2' '
1120 git bisect start --term-new term1 --term-old term2 $HASH4 $HASH1 &&
1121 git bisect term1 &&
1122 git bisect term1 >bisect_result &&
1123 - grep "$HASH2 is the first '\''term1'\'' commit" bisect_result &&
1123 + test_grep "$HASH2 is the first '\''term1'\'' commit" bisect_result &&
1124 git bisect log >log_to_replay.txt &&
1125 git bisect reset
1126 '
@@ -1212,7 +1212,7 @@ test_expect_success 'bisect handles annotated tags' '
1212 git bisect good tag-one &&
1213 git bisect bad tag-two >output &&
1214 bad=$(git rev-parse --verify tag-two^{commit}) &&
1215 - grep "$bad is the first '\''bad'\'' commit" output
1215 + test_grep "$bad is the first '\''bad'\'' commit" output
1216 '
1217
1218 test_expect_success 'bisect run fails with exit code equals or greater than 128' '
@@ -1236,29 +1236,29 @@ test_expect_success 'bisect visualize with a filename with dash and space' '
1236 test_expect_success 'bisect state output with multiple good commits' '
1237 git bisect reset &&
1238 git bisect start >output &&
1239 - grep "waiting for both '\''good'\'' and '\''bad'\'' commits" output &&
1239 + test_grep "waiting for both '\''good'\'' and '\''bad'\'' commits" output &&
1240 git bisect log >output &&
1241 - grep "waiting for both '\''good'\'' and '\''bad'\'' commits" output &&
1241 + test_grep "waiting for both '\''good'\'' and '\''bad'\'' commits" output &&
1242 git bisect good "$HASH1" >output &&
1243 - grep "waiting for '\''bad'\'' commit, 1 '\''good'\'' commit known" output &&
1243 + test_grep "waiting for '\''bad'\'' commit, 1 '\''good'\'' commit known" output &&
1244 git bisect log >output &&
1245 - grep "waiting for '\''bad'\'' commit, 1 '\''good'\'' commit known" output &&
1245 + test_grep "waiting for '\''bad'\'' commit, 1 '\''good'\'' commit known" output &&
1246 git bisect good "$HASH2" >output &&
1247 - grep "waiting for '\''bad'\'' commit, 2 '\''good'\'' commits known" output &&
1247 + test_grep "waiting for '\''bad'\'' commit, 2 '\''good'\'' commits known" output &&
1248 git bisect log >output &&
1249 - grep "waiting for '\''bad'\'' commit, 2 '\''good'\'' commits known" output
1249 + test_grep "waiting for '\''bad'\'' commit, 2 '\''good'\'' commits known" output
1250 '
1251
1252 test_expect_success 'bisect state output with bad commit' '
1253 git bisect reset &&
1254 git bisect start >output &&
1255 - grep "waiting for both '\''good'\'' and '\''bad'\'' commits" output &&
1255 + test_grep "waiting for both '\''good'\'' and '\''bad'\'' commits" output &&
1256 git bisect log >output &&
1257 - grep "waiting for both '\''good'\'' and '\''bad'\'' commits" output &&
1257 + test_grep "waiting for both '\''good'\'' and '\''bad'\'' commits" output &&
1258 git bisect bad "$HASH4" >output &&
1259 - grep -F "waiting for '\''good'\'' commit(s), '\''bad'\'' commit known" output &&
1259 + test_grep -F "waiting for '\''good'\'' commit(s), '\''bad'\'' commit known" output &&
1260 git bisect log >output &&
1261 - grep -F "waiting for '\''good'\'' commit(s), '\''bad'\'' commit known" output
1261 + test_grep -F "waiting for '\''good'\'' commit(s), '\''bad'\'' commit known" output
1262 '
1263
1264 test_expect_success 'verify correct error message' '
@@ -1268,7 +1268,7 @@ test_expect_success 'verify correct error message' '
1268 rm .git/BISECT*
1269 EOF
1270 test_must_fail git bisect run ./test_script.sh 2>error &&
1271 - grep "git bisect good.*exited with error code" error
1271 + test_grep "git bisect good.*exited with error code" error
1272 '
1273
1274 test_done
t/t6040-tracking-info.sh
+1 -1
@@ -275,7 +275,7 @@ test_expect_success '--set-upstream-to does not change branch' '
275 git branch --set-upstream-to main from-topic_2 &&
276 git config branch.from-main.merge > actual &&
277 git rev-parse from-topic_2 >actual2 &&
278 - grep -q "^refs/heads/main$" actual &&
278 + test_grep -q "^refs/heads/main$" actual &&
279 cmp expect2 actual2
280 '
281
t/t6112-rev-list-filters-objects.sh
+12 -12
@@ -45,8 +45,8 @@ test_expect_success 'specify blob explicitly prevents filtering' '
45 awk -f print_2.awk) &&
46
47 git -C r1 rev-list --objects --filter=blob:none HEAD $file_3 >observed &&
48 - grep "$file_3" observed &&
49 - ! grep "$file_4" observed
48 + test_grep "$file_3" observed &&
49 + test_grep ! "$file_4" observed
50 '
51
52 test_expect_success 'verify emitted+omitted == all' '
@@ -324,7 +324,7 @@ test_expect_success 'rev-list W/ --missing=print and --missing=allow-any for tre
324
325 git -C r3.b rev-list --missing=allow-any --objects HEAD \
326 >objs 2>rev_list_err &&
327 - ! grep $TREE objs &&
327 + test_grep ! $TREE objs &&
328 test_must_be_empty rev_list_err
329 '
330
@@ -353,7 +353,7 @@ test_expect_success 'verify skipping tree iteration when not collecting omits' '
353 test_line_count = 2 actual &&
354
355 # Make sure no other trees were considered besides the root.
356 - ! grep "Skipping contents of tree [^.]" filter_trace &&
356 + test_grep ! "Skipping contents of tree [^.]" filter_trace &&
357
358 # Try this again with "combine:". If both sub-filters are skipping
359 # trees, the composite filter should also skip trees. This is not
@@ -539,7 +539,7 @@ test_expect_success 'combine:... with more than two sub-filters' '
539 HEAD >actual &&
540
541 test_cmp expect actual &&
542 - grep "Add to combine filter-spec: sparse:oid=main:p%3bat%25ter%2bn" \
542 + test_grep "Add to combine filter-spec: sparse:oid=main:p%3bat%25ter%2bn" \
543 trace1 &&
544
545 # Repeat the above test, but this time, the characters to encode are in
@@ -551,7 +551,7 @@ test_expect_success 'combine:... with more than two sub-filters' '
551 HEAD >actual &&
552
553 test_cmp expect actual &&
554 - grep "Add to combine filter-spec: sparse:oid=main:%5e%7epattern" \
554 + test_grep "Add to combine filter-spec: sparse:oid=main:%5e%7epattern" \
555 trace2
556 '
557
@@ -623,9 +623,9 @@ test_expect_success 'verify collecting omits in combined: filter' '
623 omitted_2=$(echo a | git hash-object --stdin) &&
624 omitted_3=$(echo abcde | git hash-object --stdin) &&
625
626 - grep "~$omitted_1" actual &&
627 - grep "~$omitted_2" actual &&
628 - grep "~$omitted_3" actual &&
626 + test_grep "~$omitted_1" actual &&
627 + test_grep "~$omitted_2" actual &&
628 + test_grep "~$omitted_3" actual &&
629 test_line_count = 3 actual
630 '
631
@@ -654,7 +654,7 @@ test_expect_success 'tree:<depth> which filters out blob but given as arg' '
654 blob_hash=$(git -C r4 rev-parse HEAD:subdir/bar) &&
655
656 git -C r4 rev-list --objects --filter=tree:1 HEAD $blob_hash >actual &&
657 - grep ^$blob_hash actual
657 + test_grep ^$blob_hash actual
658 '
659
660 # Delete some loose objects and use rev-list, but WITHOUT any filtering.
@@ -693,8 +693,8 @@ test_expect_success 'expand blob limit in protocol' '
693 git -C r2 config --local uploadpack.allowfilter 1 &&
694 GIT_TRACE_PACKET="$(pwd)/trace" git -c protocol.version=2 clone \
695 --filter=blob:limit=1k "file://$(pwd)/r2" limit &&
696 - ! grep "blob:limit=1k" trace &&
697 - grep "blob:limit=1024" trace
696 + test_grep ! "blob:limit=1k" trace &&
697 + test_grep "blob:limit=1024" trace
698 '
699
700 test_expect_success EXPENSIVE 'large sparse filter file ignored' '
t/t6115-rev-list-du.sh
+2 -2
@@ -61,13 +61,13 @@ check_du --all --objects --unpacked
61 test_expect_success 'rev-list --disk-usage=human' '
62 git rev-list --objects HEAD --disk-usage=human >actual &&
63 disk_usage_slow --objects HEAD >actual_size &&
64 - grep "$(cat actual_size) bytes" actual
64 + test_grep "$(cat actual_size) bytes" actual
65 '
66
67 test_expect_success 'rev-list --disk-usage=human with bitmaps' '
68 git rev-list --objects HEAD --use-bitmap-index --disk-usage=human >actual &&
69 disk_usage_slow --objects HEAD >actual_size &&
70 - grep "$(cat actual_size) bytes" actual
70 + test_grep "$(cat actual_size) bytes" actual
71 '
72
73 test_expect_success 'rev-list use --disk-usage unproperly' '
t/t6120-describe.sh
+7 -7
@@ -128,7 +128,7 @@ test_expect_success 'renaming tag A to Q locally produces a warning' "
128 warning: tag 'Q' is externally known as 'A'
129 EOF
130 test_cmp expected err &&
131 - grep -E '^A-8-g[0-9a-f]+$' out
131 + test_grep -E '^A-8-g[0-9a-f]+$' out
132 "
133
134 test_expect_success 'misnamed annotated tag forces long output' '
@@ -160,7 +160,7 @@ check_describe A-8-gHASH HEAD
160 test_expect_success 'describe works from outside repo using --git-dir' '
161 git clone --bare "$TRASH_DIRECTORY" "$TRASH_DIRECTORY/bare" &&
162 git --git-dir "$TRASH_DIRECTORY/bare" describe >out &&
163 - grep -E "^A-8-g[0-9a-f]+$" out
163 + test_grep -E "^A-8-g[0-9a-f]+$" out
164 '
165
166 check_describe "A-8-gHASH" --dirty
@@ -170,7 +170,7 @@ test_expect_success 'describe --dirty with --work-tree' '
170 cd "$TEST_DIRECTORY" &&
171 git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe --dirty >"$TRASH_DIRECTORY/out"
172 ) &&
173 - grep -E "^A-8-g[0-9a-f]+$" out
173 + test_grep -E "^A-8-g[0-9a-f]+$" out
174 '
175
176 test_expect_success 'set-up dirty work tree' '
@@ -183,7 +183,7 @@ test_expect_success 'describe --dirty with --work-tree (dirty)' '
183 cd "$TEST_DIRECTORY" &&
184 git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe --dirty >"$TRASH_DIRECTORY/out"
185 ) &&
186 - grep -E "^A-8-g[0-9a-f]+-dirty$" out &&
186 + test_grep -E "^A-8-g[0-9a-f]+-dirty$" out &&
187 test_cmp expected out
188 '
189
@@ -193,7 +193,7 @@ test_expect_success 'describe --dirty=.mod with --work-tree (dirty)' '
193 cd "$TEST_DIRECTORY" &&
194 git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe --dirty=.mod >"$TRASH_DIRECTORY/out"
195 ) &&
196 - grep -E "^A-8-g[0-9a-f]+.mod$" out &&
196 + test_grep -E "^A-8-g[0-9a-f]+.mod$" out &&
197 test_cmp expected out
198 '
199
@@ -377,7 +377,7 @@ test_expect_success 'describe chokes on severely broken submodules' '
377
378 test_expect_success 'describe ignoring a broken submodule' '
379 git describe --broken >out &&
380 - grep broken out
380 + test_grep broken out
381 '
382
383 test_expect_success 'describe with --work-tree ignoring a broken submodule' '
@@ -386,7 +386,7 @@ test_expect_success 'describe with --work-tree ignoring a broken submodule' '
386 git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe --broken >"$TRASH_DIRECTORY/out"
387 ) &&
388 test_when_finished "mv .git/modules/sub_moved .git/modules/sub1" &&
389 - grep broken out
389 + test_grep broken out
390 '
391
392 test_expect_success 'describe a blob at a directly tagged commit' '
t/t6200-fmt-merge-msg.sh
+41 -41
@@ -125,20 +125,20 @@ test_expect_success GPG 'message for merging local tag signed by good key' '
125 git checkout main &&
126 git fetch . signed-good-tag &&
127 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
128 - grep "^Merge tag ${apos}signed-good-tag${apos}" actual &&
129 - grep "^signed-tag-msg" actual &&
130 - grep "^# gpg: Signature made" actual &&
131 - grep "^# gpg: Good signature from" actual
128 + test_grep "^Merge tag ${apos}signed-good-tag${apos}" actual &&
129 + test_grep "^signed-tag-msg" actual &&
130 + test_grep "^# gpg: Signature made" actual &&
131 + test_grep "^# gpg: Good signature from" actual
132 '
133
134 test_expect_success GPG 'message for merging local tag signed by unknown key' '
135 git checkout main &&
136 git fetch . signed-good-tag &&
137 GNUPGHOME=. git fmt-merge-msg <.git/FETCH_HEAD >actual &&
138 - grep "^Merge tag ${apos}signed-good-tag${apos}" actual &&
139 - grep "^signed-tag-msg" actual &&
140 - grep "^# gpg: Signature made" actual &&
141 - grep -E "^# gpg: Can${apos}t check signature: (public key not found|No public key)" actual
138 + test_grep "^Merge tag ${apos}signed-good-tag${apos}" actual &&
139 + test_grep "^signed-tag-msg" actual &&
140 + test_grep "^# gpg: Signature made" actual &&
141 + test_grep -E "^# gpg: Can${apos}t check signature: (public key not found|No public key)" actual
142 '
143
144 test_expect_success GPGSSH 'message for merging local tag signed by good ssh key' '
@@ -146,10 +146,10 @@ test_expect_success GPGSSH 'message for merging local tag signed by good ssh key
146 git checkout main &&
147 git fetch . signed-good-ssh-tag &&
148 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
149 - grep "^Merge tag ${apos}signed-good-ssh-tag${apos}" actual &&
150 - grep "^signed-ssh-tag-msg" actual &&
151 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
152 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual
149 + test_grep "^Merge tag ${apos}signed-good-ssh-tag${apos}" actual &&
150 + test_grep "^signed-ssh-tag-msg" actual &&
151 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
152 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual
153 '
154
155 test_expect_success GPGSSH 'message for merging local tag signed by unknown ssh key' '
@@ -157,11 +157,11 @@ test_expect_success GPGSSH 'message for merging local tag signed by unknown ssh
157 git checkout main &&
158 git fetch . signed-untrusted-ssh-tag &&
159 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
160 - grep "^Merge tag ${apos}signed-untrusted-ssh-tag${apos}" actual &&
161 - grep "^signed-ssh-tag-msg-untrusted" actual &&
162 - grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
163 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
164 - grep "${GPGSSH_KEY_NOT_TRUSTED}" actual
160 + test_grep "^Merge tag ${apos}signed-untrusted-ssh-tag${apos}" actual &&
161 + test_grep "^signed-ssh-tag-msg-untrusted" actual &&
162 + test_grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
163 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
164 + test_grep "${GPGSSH_KEY_NOT_TRUSTED}" actual
165 '
166
167 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'message for merging local tag signed by expired ssh key' '
@@ -169,9 +169,9 @@ test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'message for merging local tag sign
169 git checkout main &&
170 git fetch . expired-signed &&
171 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
172 - grep "^Merge tag ${apos}expired-signed${apos}" actual &&
173 - grep "^expired-signed" actual &&
174 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
172 + test_grep "^Merge tag ${apos}expired-signed${apos}" actual &&
173 + test_grep "^expired-signed" actual &&
174 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
175 '
176
177 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'message for merging local tag signed by not yet valid ssh key' '
@@ -179,9 +179,9 @@ test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'message for merging local tag sign
179 git checkout main &&
180 git fetch . notyetvalid-signed &&
181 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
182 - grep "^Merge tag ${apos}notyetvalid-signed${apos}" actual &&
183 - grep "^notyetvalid-signed" actual &&
184 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
182 + test_grep "^Merge tag ${apos}notyetvalid-signed${apos}" actual &&
183 + test_grep "^notyetvalid-signed" actual &&
184 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
185 '
186
187 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'message for merging local tag signed by valid timeboxed ssh key' '
@@ -189,10 +189,10 @@ test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'message for merging local tag sign
189 git checkout main &&
190 git fetch . timeboxedvalid-signed &&
191 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
192 - grep "^Merge tag ${apos}timeboxedvalid-signed${apos}" actual &&
193 - grep "^timeboxedvalid-signed" actual &&
194 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
195 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual
192 + test_grep "^Merge tag ${apos}timeboxedvalid-signed${apos}" actual &&
193 + test_grep "^timeboxedvalid-signed" actual &&
194 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
195 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual
196 '
197
198 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'message for merging local tag signed by invalid timeboxed ssh key' '
@@ -200,9 +200,9 @@ test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'message for merging local tag sign
200 git checkout main &&
201 git fetch . timeboxedinvalid-signed &&
202 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
203 - grep "^Merge tag ${apos}timeboxedinvalid-signed${apos}" actual &&
204 - grep "^timeboxedinvalid-signed" actual &&
205 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
203 + test_grep "^Merge tag ${apos}timeboxedinvalid-signed${apos}" actual &&
204 + test_grep "^timeboxedinvalid-signed" actual &&
205 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
206 '
207
208 test_expect_success 'message for merging external branch' '
@@ -651,21 +651,21 @@ test_expect_success 'merge --into-name=<name>' '
651 git show -s --format="%s" >full.0 &&
652 head -n1 full.0 >actual &&
653 # expect that HEAD is shown as-is
654 - grep -e "Merge branch .side. into HEAD$" actual &&
654 + test_grep -e "Merge branch .side. into HEAD$" actual &&
655
656 git reset --hard main &&
657 git merge --no-ff --into-name=main side &&
658 git show -s --format="%s" >full.1 &&
659 head -n1 full.1 >actual &&
660 # expect that we pretend to be merging to main, that is suppressed
661 - grep -e "Merge branch .side.$" actual &&
661 + test_grep -e "Merge branch .side.$" actual &&
662
663 git checkout -b throwaway main &&
664 git merge --no-ff --into-name=main side &&
665 git show -s --format="%s" >full.2 &&
666 head -n1 full.2 >actual &&
667 # expect that we pretend to be merging to main, that is suppressed
668 - grep -e "Merge branch .side.$" actual
668 + test_grep -e "Merge branch .side.$" actual
669 '
670
671 test_expect_success 'merge.suppressDest configuration' '
@@ -677,28 +677,28 @@ test_expect_success 'merge.suppressDest configuration' '
677
678 git -c merge.suppressDest="" fmt-merge-msg <.git/FETCH_HEAD >full.1 &&
679 head -n1 full.1 >actual &&
680 - grep -e "Merge branch .side. into main" actual &&
680 + test_grep -e "Merge branch .side. into main" actual &&
681
682 git -c merge.suppressDest="mast" fmt-merge-msg <.git/FETCH_HEAD >full.2 &&
683 head -n1 full.2 >actual &&
684 - grep -e "Merge branch .side. into main$" actual &&
684 + test_grep -e "Merge branch .side. into main$" actual &&
685
686 git -c merge.suppressDest="ma?*[rn]" fmt-merge-msg <.git/FETCH_HEAD >full.3 &&
687 head -n1 full.3 >actual &&
688 - grep -e "Merge branch .side." actual &&
689 - ! grep -e " into main$" actual &&
688 + test_grep -e "Merge branch .side." actual &&
689 + test_grep ! -e " into main$" actual &&
690
691 git checkout --detach HEAD &&
692 git -c merge.suppressDest="main" fmt-merge-msg <.git/FETCH_HEAD >full.4 &&
693 head -n1 full.4 >actual &&
694 - grep -e "Merge branch .side. into HEAD$" actual &&
694 + test_grep -e "Merge branch .side. into HEAD$" actual &&
695
696 git -c merge.suppressDest="main" fmt-merge-msg \
697 --into-name=main <.git/FETCH_HEAD >full.5 &&
698 head -n1 full.5 >actual &&
699 - grep -e "Merge branch .side." actual &&
700 - ! grep -e " into main$" actual &&
701 - ! grep -e " into HEAD$" actual
699 + test_grep -e "Merge branch .side." actual &&
700 + test_grep ! -e " into main$" actual &&
701 + test_grep ! -e " into HEAD$" actual
702 '
703
704 test_done
t/t6402-merge-rename.sh
+2 -2
@@ -332,7 +332,7 @@ test_expect_success 'Same as previous, but merged other way' '
332 git checkout -q dir-in-way^0 &&
333 test_must_fail git merge --strategy=recursive renamed-file-has-no-conflicts >output 2>errors &&
334
335 - ! grep "error: refusing to lose untracked file at" errors &&
335 + test_grep ! "error: refusing to lose untracked file at" errors &&
336 test_grep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
337 test_grep "Auto-merging dir" output &&
338 test_grep "moving it to dir~renamed-file-has-no-conflicts instead" output &&
@@ -883,7 +883,7 @@ test_expect_success 'setup spurious "refusing to lose untracked" message' '
883 test_expect_success 'no spurious "refusing to lose untracked" message' '
884 git checkout main^0 &&
885 test_must_fail git merge rename^0 2>errors.txt &&
886 - ! grep "refusing to lose untracked file" errors.txt
886 + test_grep ! "refusing to lose untracked file" errors.txt
887 '
888
889 test_expect_success 'do not follow renames for empty files' '
t/t6403-merge-file.sh
+3 -3
@@ -356,7 +356,7 @@ test_expect_success "expected conflict markers" '
356 test_expect_success 'binary files cannot be merged' '
357 test_must_fail git merge-file -p \
358 orig.txt "$TEST_DIRECTORY"/test-binary-1.png new1.txt 2> merge.err &&
359 - grep "Cannot merge binary files" merge.err
359 + test_grep "Cannot merge binary files" merge.err
360 '
361
362 test_expect_success 'binary files cannot be merged with --object-id' '
@@ -364,7 +364,7 @@ test_expect_success 'binary files cannot be merged with --object-id' '
364 git add orig.txt new1.txt test-binary-1.png &&
365 test_must_fail git merge-file --object-id \
366 :orig.txt :test-binary-1.png :new1.txt 2> merge.err &&
367 - grep "Cannot merge binary files" merge.err
367 + test_grep "Cannot merge binary files" merge.err
368 '
369
370 test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '
@@ -539,7 +539,7 @@ test_expect_success 'conflict sections match existing line endings' '
539 test_expect_success '--object-id fails without repository' '
540 empty="$(test_oid empty_blob)" &&
541 nongit test_must_fail git merge-file --object-id $empty $empty $empty 2>err &&
542 - grep "not a git repository" err
542 + test_grep "not a git repository" err
543 '
544
545 test_expect_success 'run in a linked worktree with --object-id' '
t/t6404-recursive-merge.sh
+1 -1
@@ -109,7 +109,7 @@ test_expect_success 'refuse to merge binary files' '
109 git add binary-file &&
110 git commit -m binary2 &&
111 test_must_fail git merge F >merge_output &&
112 - grep "Cannot merge binary files: binary-file (HEAD vs. F)" merge_output
112 + test_grep "Cannot merge binary files: binary-file (HEAD vs. F)" merge_output
113 '
114
115 test_expect_success 'mark rename/delete as unmerged' '
t/t6406-merge-attr.sh
+10 -10
@@ -97,11 +97,11 @@ test_expect_success 'check merge result in index' '
97 test_expect_success 'check merge result in working tree' '
98
99 git cat-file -p HEAD:binary >binary-orig &&
100 - grep "<<<<<<<" text &&
100 + test_grep "<<<<<<<" text &&
101 cmp binary-orig binary &&
102 - ! grep "<<<<<<<" union &&
103 - grep Main union &&
104 - grep Side union
102 + test_grep ! "<<<<<<<" union &&
103 + test_grep Main union &&
104 + test_grep Side union
105
106 '
107
@@ -112,9 +112,9 @@ test_expect_success 'retry the merge with longer context' '
112 s/ .*$//
113 p
114 }" >actual text &&
115 - grep ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" actual &&
116 - grep "================================" actual &&
117 - grep "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" actual
115 + test_grep ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" actual &&
116 + test_grep "================================" actual &&
117 + test_grep "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" actual
118 '
119
120 test_expect_success 'invalid conflict-marker-size 3a' '
@@ -193,7 +193,7 @@ test_expect_success !WINDOWS 'custom merge driver that is killed with a signal'
193 >./please-abort &&
194 echo "* merge=custom" >.gitattributes &&
195 test_expect_code 2 git merge main 2>err &&
196 - grep "^error: failed to execute internal merge" err &&
196 + test_grep "^error: failed to execute internal merge" err &&
197 git ls-files -u >output &&
198 git diff --name-only HEAD >>output &&
199 test_must_be_empty output
@@ -260,7 +260,7 @@ test_expect_success 'binary files with union attribute' '
260 git commit -am two &&
261
262 test_must_fail git merge bin-main >output &&
263 - grep -i "warning.*cannot merge.*HEAD vs. bin-main" output
263 + test_grep -i "warning.*cannot merge.*HEAD vs. bin-main" output
264 '
265
266 test_expect_success !WINDOWS 'custom merge driver that is killed with a signal on recursive merge' '
@@ -297,7 +297,7 @@ test_expect_success !WINDOWS 'custom merge driver that is killed with a signal o
297 >./please-abort &&
298 echo "* merge=custom" >.gitattributes &&
299 test_expect_code 2 git merge recursive-a 2>err &&
300 - grep "error: failed to execute internal merge" err &&
300 + test_grep "error: failed to execute internal merge" err &&
301 git ls-files -u >output &&
302 git diff --name-only HEAD >>output &&
303 test_must_be_empty output
t/t6417-merge-ours-theirs.sh
+15 -15
@@ -26,31 +26,31 @@ test_expect_success setup '
26 test_expect_success 'plain recursive - should conflict' '
27 git reset --hard main &&
28 test_must_fail git merge -s recursive side &&
29 - grep nine file &&
30 - grep nueve file &&
31 - ! grep 9 file &&
32 - grep one file &&
33 - ! grep 1 file
29 + test_grep nine file &&
30 + test_grep nueve file &&
31 + test_grep ! 9 file &&
32 + test_grep one file &&
33 + test_grep ! 1 file
34 '
35
36 test_expect_success 'recursive favouring theirs' '
37 git reset --hard main &&
38 git merge -s recursive -Xtheirs side &&
39 - ! grep nine file &&
40 - grep nueve file &&
41 - ! grep 9 file &&
42 - grep one file &&
43 - ! grep 1 file
39 + test_grep ! nine file &&
40 + test_grep nueve file &&
41 + test_grep ! 9 file &&
42 + test_grep one file &&
43 + test_grep ! 1 file
44 '
45
46 test_expect_success 'recursive favouring ours' '
47 git reset --hard main &&
48 git merge -s recursive -X ours side &&
49 - grep nine file &&
50 - ! grep nueve file &&
51 - ! grep 9 file &&
52 - grep one file &&
53 - ! grep 1 file
49 + test_grep nine file &&
50 + test_grep ! nueve file &&
51 + test_grep ! 9 file &&
52 + test_grep one file &&
53 + test_grep ! 1 file
54 '
55
56 test_expect_success 'binary file with -Xours/-Xtheirs' '
t/t6418-merge-text-auto.sh
+1 -1
@@ -226,7 +226,7 @@ test_expect_success 'rename/delete vs. renormalization' '
226 git checkout rename^0 &&
227 test_must_fail git -c merge.renormalize=true merge nuke >out &&
228
229 - grep "rename/delete" out
229 + test_grep "rename/delete" out
230 )
231 '
232
t/t6422-merge-rename-corner-cases.sh
+4 -4
@@ -916,8 +916,8 @@ test_expect_success 'rad-check: rename/add/delete conflict' '
916 # bar should have two-way merged contents of the different
917 # versions of bar; check that content from both sides is
918 # present.
919 - grep original bar &&
920 - grep different bar
919 + test_grep original bar &&
920 + test_grep different bar
921 )
922 '
923
@@ -991,8 +991,8 @@ test_expect_success 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
991 # baz should have two-way merged contents of the original
992 # contents of foo and bar; check that content from both sides
993 # is present.
994 - grep foo baz &&
995 - grep bar baz
994 + test_grep foo baz &&
995 + test_grep bar baz
996 )
997 '
998
t/t6423-merge-rename-directories.sh
+36 -36
@@ -1113,7 +1113,7 @@ test_expect_success '5c: Transitive rename would cause rename/rename/rename/add/
1113 test_cmp expect actual &&
1114 test_path_is_missing x/d &&
1115 test_path_is_file y/d &&
1116 - grep -q "<<<<" y/d # conflict markers should be present
1116 + test_grep -q "<<<<" y/d # conflict markers should be present
1117 )
1118 '
1119
@@ -2841,10 +2841,10 @@ test_expect_success '9e: N-to-1 whammo' '
2841
2842 test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
2843 grep "CONFLICT (implicit dir rename): Cannot map more than one path to combined/yo" out >error_line &&
2844 - grep -q dir1/yo error_line &&
2845 - grep -q dir2/yo error_line &&
2846 - grep -q dir3/yo error_line &&
2847 - grep -q dirN/yo error_line &&
2844 + test_grep -q dir1/yo error_line &&
2845 + test_grep -q dir2/yo error_line &&
2846 + test_grep -q dir3/yo error_line &&
2847 + test_grep -q dirN/yo error_line &&
2848
2849 git ls-files -s >out &&
2850 test_line_count = 16 out &&
@@ -3578,7 +3578,7 @@ test_expect_success '11b: Avoid losing dirty file involved in directory rename'
3578 test_path_is_missing .git/MERGE_HEAD &&
3579 test_grep "error: Your local changes to the following files would be overwritten by merge" err &&
3580
3581 - grep -q stuff z/c &&
3581 + test_grep -q stuff z/c &&
3582 test_seq 1 10 >expected &&
3583 echo stuff >>expected &&
3584 test_cmp expected z/c
@@ -3636,7 +3636,7 @@ test_expect_success '11c: Avoid losing not-uptodate with rename + D/F conflict'
3636 test_path_is_missing .git/MERGE_HEAD &&
3637 test_grep "error: Your local changes to the following files would be overwritten by merge" err &&
3638
3639 - grep -q stuff y/c &&
3639 + test_grep -q stuff y/c &&
3640 test_seq 1 10 >expected &&
3641 echo stuff >>expected &&
3642 test_cmp expected y/c &&
@@ -3705,7 +3705,7 @@ test_expect_success '11d: Avoid losing not-uptodate with rename + D/F conflict'
3705 test_path_is_missing .git/MERGE_HEAD &&
3706 test_grep "error: Your local changes to the following files would be overwritten by merge" err &&
3707
3708 - grep -q stuff z/c &&
3708 + test_grep -q stuff z/c &&
3709 test_seq 1 10 >expected &&
3710 echo stuff >>expected &&
3711 test_cmp expected z/c
@@ -4779,7 +4779,7 @@ test_expect_success '12i: Directory rename causes rename-to-self' '
4779
4780 test_must_fail git -c merge.directoryRenames=conflict merge -s recursive B^0 >out &&
4781
4782 - grep "CONFLICT (implicit dir rename).*source/bar in the way" out &&
4782 + test_grep "CONFLICT (implicit dir rename).*source/bar in the way" out &&
4783 test_path_is_missing source/bar &&
4784 test_path_is_file source/subdir/bar &&
4785 test_path_is_file source/baz &&
@@ -4920,7 +4920,7 @@ test_expect_success '12j: Directory rename to root causes rename-to-self' '
4920 # error about there being a file in the way.
4921
4922 test_must_fail git -c merge.directoryRenames=conflict merge -s recursive B^0 >out &&
4923 - grep "CONFLICT (implicit dir rename).*bar in the way" out &&
4923 + test_grep "CONFLICT (implicit dir rename).*bar in the way" out &&
4924
4925 test_path_is_missing bar &&
4926 test_path_is_file subdir/bar &&
@@ -4999,7 +4999,7 @@ test_expect_success '12k: Directory rename with sibling causes rename-to-self' '
4999 # error about there being a file in the way.
5000
5001 test_must_fail git -c merge.directoryRenames=conflict merge -s recursive B^0 >out &&
5002 - grep "CONFLICT (implicit dir rename).*dirA/bar in the way" out &&
5002 + test_grep "CONFLICT (implicit dir rename).*dirA/bar in the way" out &&
5003
5004 test_path_is_missing dirA/bar &&
5005 test_path_is_file dirB/bar &&
@@ -5402,7 +5402,7 @@ test_expect_success '12o: Directory rename hits other rename source; file still
5402 test_stdout_line_count = 1 git ls-files -s B/stuff &&
5403 test_stdout_line_count = 1 git ls-files -s D/file2 &&
5404
5405 - grep "CONFLICT (implicit dir rename).*Existing file/dir at A/file1 in the way" out &&
5405 + test_grep "CONFLICT (implicit dir rename).*Existing file/dir at A/file1 in the way" out &&
5406 test_stdout_line_count = 1 git ls-files -s C/file1
5407 )
5408 '
@@ -5489,7 +5489,7 @@ test_expect_success '12p: Directory rename hits other rename source; file still
5489 test_stdout_line_count = 1 git ls-files -s B/stuff &&
5490 test_stdout_line_count = 1 git ls-files -s D/file2 &&
5491
5492 - grep "CONFLICT (implicit dir rename).*Existing file/dir at A/file1 in the way" out &&
5492 + test_grep "CONFLICT (implicit dir rename).*Existing file/dir at A/file1 in the way" out &&
5493 test_stdout_line_count = 1 git ls-files -s C/file1
5494 )
5495 '
@@ -5570,8 +5570,8 @@ test_expect_success '12q: Directory rename hits other rename source; file remove
5570
5571 test_must_fail git -c merge.directoryRenames=conflict merge -s recursive B^0 >out &&
5572
5573 - grep "CONFLICT (rename/delete).*A/file1.*D/file2" out &&
5574 - grep "CONFLICT (implicit dir rename).*Existing file/dir at A/file1 in the way" out &&
5573 + test_grep "CONFLICT (rename/delete).*A/file1.*D/file2" out &&
5574 + test_grep "CONFLICT (implicit dir rename).*Existing file/dir at A/file1 in the way" out &&
5575
5576 test_stdout_line_count = 6 git ls-files -s &&
5577 test_stdout_line_count = 1 git ls-files -s A/other &&
@@ -5586,7 +5586,7 @@ test_expect_success '12q: Directory rename hits other rename source; file remove
5586 # the dir rename of C/file1 -> A/file1 would mean modifying
5587 # the code so that renames do not adjust both their source
5588 # and target paths in all cases.
5589 - ! grep "CONFLICT (file location)" out &&
5589 + test_grep ! "CONFLICT (file location)" out &&
5590 test_stdout_line_count = 1 git ls-files -s C/file1
5591 )
5592 '
@@ -5652,8 +5652,8 @@ test_expect_success '13a(conflict): messages for newly added files' '
5652 test_grep CONFLICT..file.location.*z/d.added.in.B^0.*y/d out &&
5653
5654 git ls-files >paths &&
5655 - ! grep z/ paths &&
5656 - grep "y/[de]" paths &&
5655 + test_grep ! z/ paths &&
5656 + test_grep "y/[de]" paths &&
5657
5658 test_path_is_missing z/d &&
5659 test_path_is_file y/d &&
@@ -5676,8 +5676,8 @@ test_expect_success '13a(info): messages for newly added files' '
5676 test_grep Path.updated:.*z/d.added.in.B^0.*y/d out &&
5677
5678 git ls-files >paths &&
5679 - ! grep z/ paths &&
5680 - grep "y/[de]" paths &&
5679 + test_grep ! z/ paths &&
5680 + test_grep "y/[de]" paths &&
5681
5682 test_path_is_missing z/d &&
5683 test_path_is_file y/d &&
@@ -5742,8 +5742,8 @@ test_expect_success '13b(conflict): messages for transitive rename with conflict
5742 test_grep CONFLICT..file.location.*x/d.renamed.to.z/d.*moved.to.y/d out &&
5743
5744 git ls-files >paths &&
5745 - ! grep z/ paths &&
5746 - grep "y/d" paths &&
5745 + test_grep ! z/ paths &&
5746 + test_grep "y/d" paths &&
5747
5748 test_path_is_missing z/d &&
5749 test_path_is_file y/d
@@ -5764,8 +5764,8 @@ test_expect_success '13b(info): messages for transitive rename with conflicted c
5764 test_grep Path.updated:.*x/d.renamed.to.z/d.in.B^0.*moving.it.to.y/d out &&
5765
5766 git ls-files >paths &&
5767 - ! grep z/ paths &&
5768 - grep "y/d" paths &&
5767 + test_grep ! z/ paths &&
5768 + test_grep "y/d" paths &&
5769
5770 test_path_is_missing z/d &&
5771 test_path_is_file y/d
@@ -5827,8 +5827,8 @@ test_expect_success '13c(conflict): messages for rename/rename(1to1) via transit
5827 test_grep CONFLICT..file.location.*x/d.renamed.to.z/d.*moved.to.y/d out &&
5828
5829 git ls-files >paths &&
5830 - ! grep z/ paths &&
5831 - grep "y/d" paths &&
5830 + test_grep ! z/ paths &&
5831 + test_grep "y/d" paths &&
5832
5833 test_path_is_missing z/d &&
5834 test_path_is_file y/d
@@ -5848,8 +5848,8 @@ test_expect_success '13c(info): messages for rename/rename(1to1) via transitive
5848 test_grep Path.updated:.*x/d.renamed.to.z/d.in.B^0.*moving.it.to.y/d out &&
5849
5850 git ls-files >paths &&
5851 - ! grep z/ paths &&
5852 - grep "y/d" paths &&
5851 + test_grep ! z/ paths &&
5852 + test_grep "y/d" paths &&
5853
5854 test_path_is_missing z/d &&
5855 test_path_is_file y/d
@@ -5917,9 +5917,9 @@ test_expect_success '13d(conflict): messages for rename/rename(1to1) via dual tr
5917 test_grep CONFLICT..file.location.*a/y.renamed.to.c/y.*moved.to.d/y out &&
5918
5919 git ls-files >paths &&
5920 - ! grep b/ paths &&
5921 - ! grep c/ paths &&
5922 - grep "d/y" paths &&
5920 + test_grep ! b/ paths &&
5921 + test_grep ! c/ paths &&
5922 + test_grep "d/y" paths &&
5923
5924 test_path_is_missing b/y &&
5925 test_path_is_missing c/y &&
@@ -5941,9 +5941,9 @@ test_expect_success '13d(info): messages for rename/rename(1to1) via dual transi
5941 test_grep Path.updated.*a/y.renamed.to.c/y.*moving.it.to.d/y out &&
5942
5943 git ls-files >paths &&
5944 - ! grep b/ paths &&
5945 - ! grep c/ paths &&
5946 - grep "d/y" paths &&
5944 + test_grep ! b/ paths &&
5945 + test_grep ! c/ paths &&
5946 + test_grep "d/y" paths &&
5947
5948 test_path_is_missing b/y &&
5949 test_path_is_missing c/y &&
@@ -6058,8 +6058,8 @@ test_expect_success '13e: directory rename detection in recursive case' '
6058 test_must_be_empty err &&
6059
6060 git ls-files >paths &&
6061 - ! grep a/x paths &&
6062 - grep b/x paths
6061 + test_grep ! a/x paths &&
6062 + test_grep b/x paths
6063 )
6064 '
6065
t/t6424-merge-unrelated-index-changes.sh
+3 -3
@@ -298,9 +298,9 @@ test_expect_success 'with multiple strategies, recursive or ort failure do not e
298
299 test_must_fail git merge -s ort -s octopus C^0 >output 2>&1 &&
300
301 - grep "Trying merge strategy ort..." output &&
302 - grep "Trying merge strategy octopus..." output &&
303 - grep "No merge strategy handled the merge." output &&
301 + test_grep "Trying merge strategy ort..." output &&
302 + test_grep "Trying merge strategy octopus..." output &&
303 + test_grep "No merge strategy handled the merge." output &&
304
305 # Changes to "a" should remain staged
306 git rev-parse :a >actual &&
t/t6427-diff3-conflict-markers.sh
+5 -5
@@ -39,7 +39,7 @@ test_expect_success 'check no merge base' '
39
40 test_must_fail git -c merge.conflictstyle=diff3 merge --allow-unrelated-histories -s recursive R^0 &&
41
42 - grep "|||||| empty tree" content
42 + test_grep "|||||| empty tree" content
43 )
44 '
45
@@ -97,7 +97,7 @@ test_expect_success 'check unique merge base' '
97
98 test_must_fail git -c merge.conflictstyle=diff3 merge -s recursive R^0 &&
99
100 - grep "|||||| $MAIN:content" renamed
100 + test_grep "|||||| $MAIN:content" renamed
101 )
102 '
103
@@ -185,7 +185,7 @@ test_expect_success 'check multiple merge bases' '
185
186 test_must_fail git -c merge.conflictstyle=diff3 merge -s recursive R^0 &&
187
188 - grep "|||||| merged common ancestors:content" renamed
188 + test_grep "|||||| merged common ancestors:content" renamed
189 )
190 '
191
@@ -198,7 +198,7 @@ test_expect_success 'rebase --merge describes parent of commit being picked' '
198 git checkout -b side HEAD^ &&
199 test_commit side file &&
200 test_must_fail git -c merge.conflictstyle=diff3 rebase --merge main &&
201 - grep "||||||| parent of" file
201 + test_grep "||||||| parent of" file
202 )
203 '
204
@@ -207,7 +207,7 @@ test_expect_success 'rebase --apply describes fake ancestor base' '
207 cd rebase &&
208 git rebase --abort &&
209 test_must_fail git -c merge.conflictstyle=diff3 rebase --apply main &&
210 - grep "||||||| constructed fake ancestor" file
210 + test_grep "||||||| constructed fake ancestor" file
211 )
212 '
213
t/t6432-merge-recursive-space-options.sh
+2 -2
@@ -109,7 +109,7 @@ test_expect_success 'naive merge fails' '
109 git read-tree --reset -u HEAD &&
110 test_must_fail git merge-recursive HEAD^ -- HEAD remote &&
111 test_must_fail git update-index --refresh &&
112 - grep "<<<<<<" text.txt
112 + test_grep "<<<<<<" text.txt
113 '
114
115 test_expect_success '--ignore-space-change makes merge succeed' '
@@ -123,7 +123,7 @@ test_expect_success 'naive cherry-pick fails' '
123 git read-tree --reset -u HEAD &&
124 test_must_fail git cherry-pick remote &&
125 test_must_fail git update-index --refresh &&
126 - grep "<<<<<<" text.txt
126 + test_grep "<<<<<<" text.txt
127 '
128
129 test_expect_success '-Xignore-space-change makes cherry-pick succeed' '
t/t6436-merge-overwrite.sh
+3 -3
@@ -189,10 +189,10 @@ test_expect_success 'set up unborn branch and content' '
189
190 test_expect_success 'will not clobber WT/index when merging into unborn' '
191 git merge main &&
192 - grep foo tracked-file &&
192 + test_grep foo tracked-file &&
193 git show :tracked-file >expect &&
194 - grep foo expect &&
195 - grep bar untracked-file
194 + test_grep foo expect &&
195 + test_grep bar untracked-file
196 '
197
198 test_done
t/t6437-submodule-merge.sh
+5 -5
@@ -111,7 +111,7 @@ test_expect_success 'merging should conflict for non fast-forward' '
111 git checkout -b test-nonforward-a b &&
112 test_must_fail git merge c 2>actual &&
113 sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
114 - grep "$sub_expect" actual
114 + test_grep "$sub_expect" actual
115 )
116 '
117
@@ -148,7 +148,7 @@ test_expect_success 'merging should conflict for non fast-forward (resolution ex
148 git rev-parse --short sub-d > ../expect) &&
149 test_must_fail git merge c >actual 2>sub-actual &&
150 sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
151 - grep "$sub_expect" sub-actual &&
151 + test_grep "$sub_expect" sub-actual &&
152 grep $(cat expect) actual > /dev/null &&
153 git reset --hard)
154 '
@@ -164,7 +164,7 @@ test_expect_success 'merging should fail for ambiguous common parent' '
164 ) &&
165 test_must_fail git merge c >actual 2>sub-actual &&
166 sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
167 - grep "$sub_expect" sub-actual &&
167 + test_grep "$sub_expect" sub-actual &&
168 grep $(cat expect1) actual > /dev/null &&
169 grep $(cat expect2) actual > /dev/null &&
170 git reset --hard)
@@ -207,7 +207,7 @@ test_expect_success 'merging should fail for changes that are backwards' '
207 git checkout -b test-backward e &&
208 test_must_fail git merge f 2>actual &&
209 sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-d)" &&
210 - grep "$sub_expect" actual
210 + test_grep "$sub_expect" actual
211 )
212 '
213
@@ -513,7 +513,7 @@ test_expect_success 'merging should fail with no merge base' '
513 git commit -m "b" &&
514 test_must_fail git merge a 2>actual &&
515 sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short HEAD^1)" &&
516 - grep "$sub_expect" actual
516 + test_grep "$sub_expect" actual
517 )
518 '
519
t/t6500-gc.sh
+4 -4
@@ -176,15 +176,15 @@ test_expect_success 'gc.reflogExpire{Unreachable,}=never skips "expire" via "gc"
176
177 # Check that git-pack-refs is run as a sanity check (done via
178 # gc_before_repack()) but that git-expire is not.
179 - grep -E "^trace: (built-in|exec|run_command): git pack-refs --" trace.out &&
180 - ! grep -E "^trace: (built-in|exec|run_command): git reflog expire --" trace.out
179 + test_grep -E "^trace: (built-in|exec|run_command): git pack-refs --" trace.out &&
180 + test_grep ! -E "^trace: (built-in|exec|run_command): git reflog expire --" trace.out
181 '
182
183 test_expect_success 'one of gc.reflogExpire{Unreachable,}=never does not skip "expire" via "gc"' '
184 >trace.out &&
185 test_config gc.reflogExpire never &&
186 GIT_TRACE=$(pwd)/trace.out git gc &&
187 - grep -E "^trace: (built-in|exec|run_command): git reflog expire --" trace.out
187 + test_grep -E "^trace: (built-in|exec|run_command): git reflog expire --" trace.out
188 '
189
190 test_expect_success 'gc.repackFilter launches repack with a filter' '
@@ -196,7 +196,7 @@ test_expect_success 'gc.repackFilter launches repack with a filter' '
196 GIT_TRACE=$(pwd)/trace.out git -C bare.git -c gc.repackFilter=blob:none \
197 -c repack.writeBitmaps=false -c gc.cruftPacks=false gc &&
198 test_stdout_line_count = 2 ls bare.git/objects/pack/*.pack &&
199 - grep -E "^trace: (built-in|exec|run_command): git repack .* --filter=blob:none ?.*" trace.out
199 + test_grep -E "^trace: (built-in|exec|run_command): git repack .* --filter=blob:none ?.*" trace.out
200 '
201
202 test_expect_success 'gc.repackFilterTo store filtered out objects' '
t/t6600-test-reach.sh
+2 -2
@@ -958,13 +958,13 @@ test_expect_success 'merge-base without --all is one of --all results' '
958 git merge-base --all commit-5-7 commit-4-8 commit-6-6 commit-8-3 >all &&
959 git merge-base commit-5-7 commit-4-8 commit-6-6 commit-8-3 >single &&
960 test_line_count = 1 single &&
961 - grep -F -f single all &&
961 + test_grep -F -f single all &&
962
963 cp commit-graph-half .git/objects/info/commit-graph &&
964 git merge-base --all commit-5-7 commit-4-8 commit-6-6 commit-8-3 >all &&
965 git merge-base commit-5-7 commit-4-8 commit-6-6 commit-8-3 >single &&
966 test_line_count = 1 single &&
967 - grep -F -f single all
967 + test_grep -F -f single all
968 '
969
970 test_done
t/t7001-mv.sh
+8 -8
@@ -46,7 +46,7 @@ test_expect_success 'commiting the change' '
46
47 test_expect_success 'checking the commit' '
48 git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
49 - grep "^R100..*path0/COPYING..*path1/COPYING" actual
49 + test_grep "^R100..*path0/COPYING..*path1/COPYING" actual
50 '
51
52 test_expect_success 'moving the file back into subdirectory' '
@@ -60,7 +60,7 @@ test_expect_success 'commiting the change' '
60
61 test_expect_success 'checking the commit' '
62 git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
63 - grep "^R100..*path1/COPYING..*path0/COPYING" actual
63 + test_grep "^R100..*path1/COPYING..*path0/COPYING" actual
64 '
65
66 test_expect_success 'mv --dry-run does not move file' '
@@ -147,8 +147,8 @@ test_expect_success 'commiting the change' '
147
148 test_expect_success 'checking the commit' '
149 git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
150 - grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
151 - grep "^R100..*path0/README..*path2/README" actual
150 + test_grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
151 + test_grep "^R100..*path0/README..*path2/README" actual
152 '
153
154 test_expect_success 'succeed when source is a prefix of destination' '
@@ -165,8 +165,8 @@ test_expect_success 'commiting the change' '
165
166 test_expect_success 'checking the commit' '
167 git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
168 - grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
169 - grep "^R100..*path2/README..*path1/path2/README" actual
168 + test_grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
169 + test_grep "^R100..*path2/README..*path1/path2/README" actual
170 '
171
172 test_expect_success 'do not move directory over existing directory' '
@@ -200,7 +200,7 @@ test_expect_success "Michael Cassar's test case" '
200
201 T=$(git write-tree) &&
202 git ls-tree -r $T >out &&
203 - grep partA/outline.txt out
203 + test_grep partA/outline.txt out
204 '
205
206 rm -fr papers partA path?
@@ -504,7 +504,7 @@ test_expect_success 'mv -k does not accidentally destroy submodules' '
504 mkdir dummy dest &&
505 git mv -k dummy sub dest &&
506 git status --porcelain >actual &&
507 - grep "^R sub -> dest/sub" actual &&
507 + test_grep "^R sub -> dest/sub" actual &&
508 git reset --hard &&
509 git checkout .
510 '
t/t7002-mv-sparse-checkout.sh
+19 -19
@@ -319,8 +319,8 @@ test_expect_success 'move clean path from in-cone to out-of-cone' '
319 test_path_is_missing sub/d &&
320 test_path_is_missing folder1/d &&
321 git ls-files -t >actual &&
322 - ! grep "^H sub/d\$" actual &&
323 - grep "S folder1/d" actual
322 + test_grep ! "^H sub/d\$" actual &&
323 + test_grep "S folder1/d" actual
324 '
325
326 test_expect_success 'move clean path from in-cone to out-of-cone overwrite' '
@@ -346,8 +346,8 @@ test_expect_success 'move clean path from in-cone to out-of-cone overwrite' '
346 test_path_is_missing sub/file1 &&
347 test_path_is_missing folder1/file1 &&
348 git ls-files -t >actual &&
349 - ! grep "H sub/file1" actual &&
350 - grep "S folder1/file1" actual &&
349 + test_grep ! "H sub/file1" actual &&
350 + test_grep "S folder1/file1" actual &&
351
352 # compare file content before move and after move
353 echo "sub/file1 overwrite" >expect &&
@@ -382,8 +382,8 @@ test_expect_success 'move clean path from in-cone to out-of-cone file overwrite'
382 test_path_is_missing sub/file1 &&
383 test_path_is_missing folder1/file1 &&
384 git ls-files -t >actual &&
385 - ! grep "H sub/file1" actual &&
386 - grep "S folder1/file1" actual &&
385 + test_grep ! "H sub/file1" actual &&
386 + test_grep "S folder1/file1" actual &&
387
388 # compare file content before move and after move
389 echo "sub/file1 overwrite" >expect &&
@@ -421,9 +421,9 @@ test_expect_success 'move directory with one of the files overwrite' '
421 test_path_is_missing sub/dir/e &&
422 test_path_is_missing folder1/file1 &&
423 git ls-files -t >actual &&
424 - ! grep "H sub/dir/file1" actual &&
425 - ! grep "H sub/dir/e" actual &&
426 - grep "S folder1/dir/file1" actual &&
424 + test_grep ! "H sub/dir/file1" actual &&
425 + test_grep ! "H sub/dir/e" actual &&
426 + test_grep "S folder1/dir/file1" actual &&
427
428 # compare file content before move and after move
429 echo test >expect &&
@@ -452,8 +452,8 @@ test_expect_success 'move dirty path from in-cone to out-of-cone' '
452 test_path_is_missing sub/d &&
453 test_path_is_file folder1/d &&
454 git ls-files -t >actual &&
455 - ! grep "^H sub/d\$" actual &&
456 - grep "H folder1/d" actual
455 + test_grep ! "^H sub/d\$" actual &&
456 + test_grep "H folder1/d" actual
457 '
458
459 test_expect_success 'move dir from in-cone to out-of-cone' '
@@ -473,8 +473,8 @@ test_expect_success 'move dir from in-cone to out-of-cone' '
473 test_path_is_missing sub/dir &&
474 test_path_is_missing folder1 &&
475 git ls-files -t >actual &&
476 - ! grep "H sub/dir/e" actual &&
477 - grep "S folder1/dir/e" actual
476 + test_grep ! "H sub/dir/e" actual &&
477 + test_grep "S folder1/dir/e" actual
478 '
479
480 test_expect_success 'move partially-dirty dir from in-cone to out-of-cone' '
@@ -506,12 +506,12 @@ test_expect_success 'move partially-dirty dir from in-cone to out-of-cone' '
506 test_path_is_file folder1/dir/e2 &&
507 test_path_is_file folder1/dir/e3 &&
508 git ls-files -t >actual &&
509 - ! grep "H sub/dir/e" actual &&
510 - ! grep "H sub/dir/e2" actual &&
511 - ! grep "H sub/dir/e3" actual &&
512 - grep "S folder1/dir/e" actual &&
513 - grep "H folder1/dir/e2" actual &&
514 - grep "H folder1/dir/e3" actual
509 + test_grep ! "H sub/dir/e" actual &&
510 + test_grep ! "H sub/dir/e2" actual &&
511 + test_grep ! "H sub/dir/e3" actual &&
512 + test_grep "S folder1/dir/e" actual &&
513 + test_grep "H folder1/dir/e2" actual &&
514 + test_grep "H folder1/dir/e3" actual
515 '
516
517 test_done
t/t7003-filter-branch.sh
+8 -8
@@ -49,7 +49,7 @@ test_expect_success 'result is really identical' '
49 test_expect_success 'rewrite bare repository identically' '
50 (git config core.bare true && cd .git &&
51 git filter-branch branch > filter-output 2>&1 &&
52 - ! grep fatal filter-output)
52 + test_grep ! fatal filter-output)
53 '
54 git config core.bare false
55 test_expect_success 'result is really identical' '
@@ -65,7 +65,7 @@ test_expect_success 'correct GIT_DIR while using -d' '
65 git filter-branch -d "$TRASHDIR/dfoo" \
66 --index-filter "cp \"$TRASHDIR\"/dfoo/backup-refs \"$TRASHDIR\"" \
67 ) &&
68 - grep drepo "$TRASHDIR/backup-refs"
68 + test_grep drepo "$TRASHDIR/backup-refs"
69 '
70
71 test_expect_success 'tree-filter works with -d' '
@@ -503,7 +503,7 @@ test_expect_success 'rewrite repository including refs that point at non-commit
503 git tag -a -m "tag to a tree" treetag $new_tree &&
504 git reset --hard HEAD &&
505 git filter-branch -f -- --all >filter-output 2>&1 &&
506 - ! grep fatal filter-output
506 + test_grep ! fatal filter-output
507 '
508
509 test_expect_success 'filter-branch handles ref deletion' '
@@ -512,7 +512,7 @@ test_expect_success 'filter-branch handles ref deletion' '
512 git tag empty &&
513 git branch to-delete &&
514 git filter-branch -f --prune-empty to-delete >out 2>&1 &&
515 - grep "to-delete.*was deleted" out &&
515 + test_grep "to-delete.*was deleted" out &&
516 test_must_fail git rev-parse --verify to-delete
517 '
518
@@ -523,8 +523,8 @@ test_expect_success 'filter-branch handles ref rewrite' '
523 git filter-branch -f \
524 --index-filter "git rm --ignore-unmatch --cached to-drop.t" \
525 rewrite >out 2>&1 &&
526 - grep "rewrite.*was rewritten" out &&
527 - ! grep -i warning out &&
526 + test_grep "rewrite.*was rewritten" out &&
527 + test_grep ! -i warning out &&
528 git diff-tree empty rewrite
529 '
530
@@ -532,8 +532,8 @@ test_expect_success 'filter-branch handles ancestor rewrite' '
532 test_commit to-exclude &&
533 git branch ancestor &&
534 git filter-branch -f ancestor -- :^to-exclude.t >out 2>&1 &&
535 - grep "ancestor.*was rewritten" out &&
536 - ! grep -i warning out &&
535 + test_grep "ancestor.*was rewritten" out &&
536 + test_grep ! -i warning out &&
537 git diff-tree HEAD^ ancestor
538 '
539
t/t7004-tag.sh
+1 -1
@@ -937,7 +937,7 @@ test_expect_success 'git tag --format with ahead-behind' '
937 test_cmp expect actual.focus &&
938
939 # Error reported for tags that point to non-commits.
940 - grep "error: object [0-9a-f]* is a blob, not a commit" err
940 + test_grep "error: object [0-9a-f]* is a blob, not a commit" err
941 '
942
943 # trying to verify annotated non-signed tags:
t/t7006-pager.sh
+8 -8
@@ -45,8 +45,8 @@ test_expect_success TTY 'LESS and LV envvars are set for pagination' '
45
46 test_terminal git log
47 ) &&
48 - grep ^LESS= pager-env.out &&
49 - grep ^LV= pager-env.out
48 + test_grep ^LESS= pager-env.out &&
49 + test_grep ^LV= pager-env.out
50 '
51
52 test_expect_success !MINGW,TTY 'LESS and LV envvars set by git-sh-setup' '
@@ -58,8 +58,8 @@ test_expect_success !MINGW,TTY 'LESS and LV envvars set by git-sh-setup' '
58 export PATH &&
59 test_terminal sh -c ". git-sh-setup && git_pager"
60 ) &&
61 - grep ^LESS= pager-env.out &&
62 - grep ^LV= pager-env.out
61 + test_grep ^LESS= pager-env.out &&
62 + test_grep ^LV= pager-env.out
63 '
64
65 test_expect_success TTY 'some commands do not use a pager' '
@@ -685,7 +685,7 @@ test_expect_success TTY 'git returns SIGPIPE on early pager exit' '
685
686 grep child_exit trace.normal >child-exits &&
687 test_line_count = 1 child-exits &&
688 - grep " code:0 " child-exits &&
688 + test_grep " code:0 " child-exits &&
689 test_path_is_file pager-used
690 '
691
@@ -706,7 +706,7 @@ test_expect_success TTY 'git returns SIGPIPE on early pager non-zero exit' '
706
707 grep child_exit trace.normal >child-exits &&
708 test_line_count = 1 child-exits &&
709 - grep " code:1 " child-exits &&
709 + test_grep " code:1 " child-exits &&
710 test_path_is_file pager-used
711 '
712
@@ -721,7 +721,7 @@ test_expect_success TTY 'git discards pager non-zero exit without SIGPIPE' '
721
722 grep child_exit trace.normal >child-exits &&
723 test_line_count = 1 child-exits &&
724 - grep " code:1 " child-exits &&
724 + test_grep " code:1 " child-exits &&
725 test_path_is_file pager-used
726 '
727
@@ -749,7 +749,7 @@ test_expect_success TTY 'git returns SIGPIPE on propagated signals from pager' '
749
750 grep child_exit trace.normal >child-exits &&
751 test_line_count = 1 child-exits &&
752 - grep " code:143 " child-exits &&
752 + test_grep " code:143 " child-exits &&
753 test_path_is_file pager-used
754 '
755
t/t7012-skip-worktree-writing.sh
+3 -3
@@ -30,7 +30,7 @@ test_expect_success 'read-tree updates worktree, dirty case' '
30 git update-index --skip-worktree init.t &&
31 echo dirty >> init.t &&
32 test_must_fail git read-tree -m -u HEAD^ &&
33 - grep -q dirty init.t &&
33 + test_grep -q dirty init.t &&
34 test "$(git ls-files -t init.t)" = "S init.t" &&
35 git update-index --no-skip-worktree init.t
36 '
@@ -48,7 +48,7 @@ test_expect_success 'read-tree removes worktree, dirty case' '
48 git update-index --skip-worktree added &&
49 echo dirty >> added &&
50 test_must_fail git read-tree -m -u HEAD^ &&
51 - grep -q dirty added &&
51 + test_grep -q dirty added &&
52 test "$(git ls-files -t added)" = "S added" &&
53 git update-index --no-skip-worktree added
54 '
@@ -173,7 +173,7 @@ test_expect_success 'stash restore in sparse checkout' '
173 echo in the way >modified &&
174 test_must_fail git stash apply 2>error&&
175
176 - grep "changes.*would be overwritten by merge" error &&
176 + test_grep "changes.*would be overwritten by merge" error &&
177
178 echo in the way >expect &&
179 test_cmp expect modified &&
t/t7030-verify-tag.sh
+26 -26
@@ -63,8 +63,8 @@ test_expect_success GPG 'verify and show signatures' '
63 for tag in initial second merge fourth-signed sixth-signed seventh-signed
64 do
65 git verify-tag $tag 2>actual &&
66 - grep "Good signature from" actual &&
67 - ! grep "BAD signature from" actual &&
66 + test_grep "Good signature from" actual &&
67 + test_grep ! "BAD signature from" actual &&
68 echo $tag OK || exit 1
69 done
70 ) &&
@@ -72,8 +72,8 @@ test_expect_success GPG 'verify and show signatures' '
72 for tag in fourth-unsigned fifth-unsigned sixth-unsigned
73 do
74 test_must_fail git verify-tag $tag 2>actual &&
75 - ! grep "Good signature from" actual &&
76 - ! grep "BAD signature from" actual &&
75 + test_grep ! "Good signature from" actual &&
76 + test_grep ! "BAD signature from" actual &&
77 echo $tag OK || exit 1
78 done
79 ) &&
@@ -81,9 +81,9 @@ test_expect_success GPG 'verify and show signatures' '
81 for tag in eighth-signed-alt
82 do
83 git verify-tag $tag 2>actual &&
84 - grep "Good signature from" actual &&
85 - ! grep "BAD signature from" actual &&
86 - grep "not certified" actual &&
84 + test_grep "Good signature from" actual &&
85 + test_grep ! "BAD signature from" actual &&
86 + test_grep "not certified" actual &&
87 echo $tag OK || exit 1
88 done
89 )
@@ -91,32 +91,32 @@ test_expect_success GPG 'verify and show signatures' '
91
92 test_expect_success GPGSM 'verify and show signatures x509' '
93 git verify-tag ninth-signed-x509 2>actual &&
94 - grep "Good signature from" actual &&
95 - ! grep "BAD signature from" actual &&
94 + test_grep "Good signature from" actual &&
95 + test_grep ! "BAD signature from" actual &&
96 echo ninth-signed-x509 OK
97 '
98
99 test_expect_success GPGSM 'verify and show signatures x509 with low minTrustLevel' '
100 test_config gpg.minTrustLevel undefined &&
101 git verify-tag ninth-signed-x509 2>actual &&
102 - grep "Good signature from" actual &&
103 - ! grep "BAD signature from" actual &&
102 + test_grep "Good signature from" actual &&
103 + test_grep ! "BAD signature from" actual &&
104 echo ninth-signed-x509 OK
105 '
106
107 test_expect_success GPGSM 'verify and show signatures x509 with matching minTrustLevel' '
108 test_config gpg.minTrustLevel fully &&
109 git verify-tag ninth-signed-x509 2>actual &&
110 - grep "Good signature from" actual &&
111 - ! grep "BAD signature from" actual &&
110 + test_grep "Good signature from" actual &&
111 + test_grep ! "BAD signature from" actual &&
112 echo ninth-signed-x509 OK
113 '
114
115 test_expect_success GPGSM 'verify and show signatures x509 with high minTrustLevel' '
116 test_config gpg.minTrustLevel ultimate &&
117 test_must_fail git verify-tag ninth-signed-x509 2>actual &&
118 - grep "Good signature from" actual &&
119 - ! grep "BAD signature from" actual &&
118 + test_grep "Good signature from" actual &&
119 + test_grep ! "BAD signature from" actual &&
120 echo ninth-signed-x509 OK
121 '
122
@@ -125,8 +125,8 @@ test_expect_success GPG 'detect fudged signature' '
125 sed -e "/^tag / s/seventh/7th-forged/" raw >forged1 &&
126 git hash-object -w -t tag forged1 >forged1.tag &&
127 test_must_fail git verify-tag $(cat forged1.tag) 2>actual1 &&
128 - grep "BAD signature from" actual1 &&
129 - ! grep "Good signature from" actual1
128 + test_grep "BAD signature from" actual1 &&
129 + test_grep ! "Good signature from" actual1
130 '
131
132 test_expect_success GPG 'verify signatures with --raw' '
@@ -134,8 +134,8 @@ test_expect_success GPG 'verify signatures with --raw' '
134 for tag in initial second merge fourth-signed sixth-signed seventh-signed
135 do
136 git verify-tag --raw $tag 2>actual &&
137 - grep "GOODSIG" actual &&
138 - ! grep "BADSIG" actual &&
137 + test_grep "GOODSIG" actual &&
138 + test_grep ! "BADSIG" actual &&
139 echo $tag OK || exit 1
140 done
141 ) &&
@@ -143,8 +143,8 @@ test_expect_success GPG 'verify signatures with --raw' '
143 for tag in fourth-unsigned fifth-unsigned sixth-unsigned
144 do
145 test_must_fail git verify-tag --raw $tag 2>actual &&
146 - ! grep "GOODSIG" actual &&
147 - ! grep "BADSIG" actual &&
146 + test_grep ! "GOODSIG" actual &&
147 + test_grep ! "BADSIG" actual &&
148 echo $tag OK || exit 1
149 done
150 ) &&
@@ -152,9 +152,9 @@ test_expect_success GPG 'verify signatures with --raw' '
152 for tag in eighth-signed-alt
153 do
154 git verify-tag --raw $tag 2>actual &&
155 - grep "GOODSIG" actual &&
156 - ! grep "BADSIG" actual &&
157 - grep "TRUST_UNDEFINED" actual &&
155 + test_grep "GOODSIG" actual &&
156 + test_grep ! "BADSIG" actual &&
157 + test_grep "TRUST_UNDEFINED" actual &&
158 echo $tag OK || exit 1
159 done
160 )
@@ -162,8 +162,8 @@ test_expect_success GPG 'verify signatures with --raw' '
162
163 test_expect_success GPGSM 'verify signatures with --raw x509' '
164 git verify-tag --raw ninth-signed-x509 2>actual &&
165 - grep "GOODSIG" actual &&
166 - ! grep "BADSIG" actual &&
165 + test_grep "GOODSIG" actual &&
166 + test_grep ! "BADSIG" actual &&
167 echo ninth-signed-x509 OK
168 '
169
t/t7031-verify-tag-signed-ssh.sh
+23 -23
@@ -71,8 +71,8 @@ test_expect_success GPGSSH 'verify and show ssh signatures' '
71 for tag in initial second merge fourth-signed sixth-signed seventh-signed
72 do
73 git verify-tag $tag 2>actual &&
74 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
75 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
74 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
75 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
76 echo $tag OK || exit 1
77 done
78 ) &&
@@ -80,8 +80,8 @@ test_expect_success GPGSSH 'verify and show ssh signatures' '
80 for tag in fourth-unsigned fifth-unsigned sixth-unsigned
81 do
82 test_must_fail git verify-tag $tag 2>actual &&
83 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
84 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
83 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
84 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
85 echo $tag OK || exit 1
86 done
87 ) &&
@@ -89,9 +89,9 @@ test_expect_success GPGSSH 'verify and show ssh signatures' '
89 for tag in eighth-signed-alt
90 do
91 test_must_fail git verify-tag $tag 2>actual &&
92 - grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
93 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
94 - grep "${GPGSSH_KEY_NOT_TRUSTED}" actual &&
92 + test_grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
93 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
94 + test_grep "${GPGSSH_KEY_NOT_TRUSTED}" actual &&
95 echo $tag OK || exit 1
96 done
97 )
@@ -100,26 +100,26 @@ test_expect_success GPGSSH 'verify and show ssh signatures' '
100 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'verify-tag exits failure on expired signature key' '
101 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
102 test_must_fail git verify-tag expired-signed 2>actual &&
103 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
103 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
104 '
105
106 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'verify-tag exits failure on not yet valid signature key' '
107 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
108 test_must_fail git verify-tag notyetvalid-signed 2>actual &&
109 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
109 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
110 '
111
112 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'verify-tag succeeds with tag date and key validity matching' '
113 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
114 git verify-tag timeboxedvalid-signed 2>actual &&
115 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
116 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual
115 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
116 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual
117 '
118
119 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'verify-tag fails with tag date outside of key validity' '
120 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
121 test_must_fail git verify-tag timeboxedinvalid-signed 2>actual &&
122 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
122 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
123 '
124
125 test_expect_success GPGSSH 'detect fudged ssh signature' '
@@ -128,9 +128,9 @@ test_expect_success GPGSSH 'detect fudged ssh signature' '
128 sed -e "/^tag / s/seventh/7th-forged/" raw >forged1 &&
129 git hash-object -w -t tag forged1 >forged1.tag &&
130 test_must_fail git verify-tag $(cat forged1.tag) 2>actual1 &&
131 - grep "${GPGSSH_BAD_SIGNATURE}" actual1 &&
132 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual1 &&
133 - ! grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual1
131 + test_grep "${GPGSSH_BAD_SIGNATURE}" actual1 &&
132 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual1 &&
133 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual1
134 '
135
136 test_expect_success GPGSSH 'verify ssh signatures with --raw' '
@@ -139,8 +139,8 @@ test_expect_success GPGSSH 'verify ssh signatures with --raw' '
139 for tag in initial second merge fourth-signed sixth-signed seventh-signed
140 do
141 git verify-tag --raw $tag 2>actual &&
142 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
143 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
142 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
143 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
144 echo $tag OK || exit 1
145 done
146 ) &&
@@ -148,8 +148,8 @@ test_expect_success GPGSSH 'verify ssh signatures with --raw' '
148 for tag in fourth-unsigned fifth-unsigned sixth-unsigned
149 do
150 test_must_fail git verify-tag --raw $tag 2>actual &&
151 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
152 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
151 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
152 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
153 echo $tag OK || exit 1
154 done
155 ) &&
@@ -157,8 +157,8 @@ test_expect_success GPGSSH 'verify ssh signatures with --raw' '
157 for tag in eighth-signed-alt
158 do
159 test_must_fail git verify-tag --raw $tag 2>actual &&
160 - grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
161 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
160 + test_grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
161 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
162 echo $tag OK || exit 1
163 done
164 )
@@ -167,8 +167,8 @@ test_expect_success GPGSSH 'verify ssh signatures with --raw' '
167 test_expect_success GPGSSH 'verify signatures with --raw ssh' '
168 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
169 git verify-tag --raw sixth-signed 2>actual &&
170 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
171 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
170 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
171 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
172 echo sixth-signed OK
173 '
174
t/t7102-reset.sh
+1 -1
@@ -87,7 +87,7 @@ do
87 test_expect_success "no 'git reset --no-$opt'" '
88 test_when_finished "rm -f err" &&
89 test_must_fail git reset --no-$opt 2>err &&
90 - grep "error: unknown option .no-$opt." err
90 + test_grep "error: unknown option .no-$opt." err
91 '
92 done
93
t/t7110-reset-merge.sh
+20 -20
@@ -29,16 +29,16 @@ test_expect_success setup '
29 # file2: C D D D --merge C D D
30 test_expect_success 'reset --merge is ok with changes in file it does not touch' '
31 git reset --merge HEAD^ &&
32 - ! grep 4 file1 &&
33 - grep 4 file2 &&
32 + test_grep ! 4 file1 &&
33 + test_grep 4 file2 &&
34 test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
35 test -z "$(git diff --cached)"
36 '
37
38 test_expect_success 'reset --merge is ok when switching back' '
39 git reset --merge second &&
40 - grep 4 file1 &&
41 - grep 4 file2 &&
40 + test_grep 4 file1 &&
41 + test_grep 4 file2 &&
42 test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
43 test -z "$(git diff --cached)"
44 '
@@ -53,16 +53,16 @@ test_expect_success 'reset --keep is ok with changes in file it does not touch'
53 git reset --hard second &&
54 cat file1 >file2 &&
55 git reset --keep HEAD^ &&
56 - ! grep 4 file1 &&
57 - grep 4 file2 &&
56 + test_grep ! 4 file1 &&
57 + test_grep 4 file2 &&
58 test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
59 test -z "$(git diff --cached)"
60 '
61
62 test_expect_success 'reset --keep is ok when switching back' '
63 git reset --keep second &&
64 - grep 4 file1 &&
65 - grep 4 file2 &&
64 + test_grep 4 file1 &&
65 + test_grep 4 file2 &&
66 test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
67 test -z "$(git diff --cached)"
68 '
@@ -79,9 +79,9 @@ test_expect_success 'reset --merge discards changes added to index (1)' '
79 echo "line 5" >> file1 &&
80 git add file1 &&
81 git reset --merge HEAD^ &&
82 - ! grep 4 file1 &&
83 - ! grep 5 file1 &&
84 - grep 4 file2 &&
82 + test_grep ! 4 file1 &&
83 + test_grep ! 5 file1 &&
84 + test_grep 4 file2 &&
85 test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
86 test -z "$(git diff --cached)"
87 '
@@ -91,9 +91,9 @@ test_expect_success 'reset --merge is ok again when switching back (1)' '
91 echo "line 5" >> file2 &&
92 git add file2 &&
93 git reset --merge second &&
94 - ! grep 4 file2 &&
95 - ! grep 5 file1 &&
96 - grep 4 file1 &&
94 + test_grep ! 4 file2 &&
95 + test_grep ! 5 file1 &&
96 + test_grep 4 file1 &&
97 test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
98 test -z "$(git diff --cached)"
99 '
@@ -121,7 +121,7 @@ test_expect_success 'reset --merge discards changes added to index (2)' '
121 echo "line 4" >> file2 &&
122 git add file2 &&
123 git reset --merge HEAD^ &&
124 - ! grep 4 file2 &&
124 + test_grep ! 4 file2 &&
125 test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
126 test -z "$(git diff)" &&
127 test -z "$(git diff --cached)"
@@ -130,8 +130,8 @@ test_expect_success 'reset --merge discards changes added to index (2)' '
130 test_expect_success 'reset --merge is ok again when switching back (2)' '
131 git reset --hard initial &&
132 git reset --merge second &&
133 - ! grep 4 file2 &&
134 - grep 4 file1 &&
133 + test_grep ! 4 file2 &&
134 + test_grep 4 file1 &&
135 test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
136 test -z "$(git diff --cached)"
137 '
@@ -147,15 +147,15 @@ test_expect_success 'reset --keep keeps changes it does not touch' '
147 echo "line 4" >> file2 &&
148 git add file2 &&
149 git reset --keep HEAD^ &&
150 - grep 4 file2 &&
150 + test_grep 4 file2 &&
151 test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
152 test -z "$(git diff --cached)"
153 '
154
155 test_expect_success 'reset --keep keeps changes when switching back' '
156 git reset --keep second &&
157 - grep 4 file2 &&
158 - grep 4 file1 &&
157 + test_grep 4 file2 &&
158 + test_grep 4 file1 &&
159 test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
160 test -z "$(git diff --cached)"
161 '
t/t7201-co.sh
+3 -3
@@ -318,7 +318,7 @@ test_expect_success 'checkout to detach HEAD' '
318 git checkout -f renamer &&
319 git clean -f &&
320 git checkout renamer^ 2>messages &&
321 - grep "HEAD is now at $rev" messages &&
321 + test_grep "HEAD is now at $rev" messages &&
322 test_line_count -gt 1 messages &&
323 H=$(git rev-parse --verify HEAD) &&
324 M=$(git show-ref -s --verify refs/heads/main) &&
@@ -794,7 +794,7 @@ test_expect_success 'switch out of non-branch' '
794 git checkout main^0 &&
795 echo modified >one &&
796 test_must_fail git checkout renamer 2>error.log &&
797 - ! grep "^Previous HEAD" error.log
797 + test_grep ! "^Previous HEAD" error.log
798 '
799
800 (
@@ -844,7 +844,7 @@ test_expect_success 'custom merge driver with checkout -m' '
844 (
845 for t in filfre-common left right
846 do
847 - grep $t arm || exit 1
847 + test_grep $t arm || exit 1
848 done
849 ) &&
850
t/t7300-clean.sh
+1 -1
@@ -793,7 +793,7 @@ test_expect_success 'traverse into directories that may have ignored entries' '
793
794 git clean -fX modules/foobar >../output &&
795
796 - grep Removing ../output &&
796 + test_grep Removing ../output &&
797
798 test_path_is_missing modules/foobar/src/generated/code.c &&
799 test_path_is_file modules/foobar/Makefile
t/t7301-clean-interactive.sh
+1 -1
@@ -479,7 +479,7 @@ test_expect_success TTY 'git clean -i paints the header in HEADER color' '
479 test_decode_color |
480 head -n 1 >header &&
481 # not i18ngrep
482 - grep "^<BOLD>" header
482 + test_grep "^<BOLD>" header
483 '
484
485 test_done
t/t7400-submodule-basic.sh
+16 -16
@@ -20,13 +20,13 @@ test_expect_success 'setup - enable local submodules' '
20
21 test_expect_success 'submodule usage: -h' '
22 git submodule -h >out 2>err &&
23 - grep "^usage: git submodule" out &&
23 + test_grep "^usage: git submodule" out &&
24 test_must_be_empty err
25 '
26
27 test_expect_success 'submodule usage: --recursive' '
28 test_expect_code 1 git submodule --recursive >out 2>err &&
29 - grep "^usage: git submodule" err &&
29 + test_grep "^usage: git submodule" err &&
30 test_must_be_empty out
31 '
32
@@ -214,14 +214,14 @@ test_expect_success 'setup parent and one repository' '
214 test_expect_success 'redirected submodule add does not show progress' '
215 git -C addtest submodule add "file://$submodurl/parent" submod-redirected \
216 2>err &&
217 - ! grep % err &&
217 + test_grep ! % err &&
218 test_grep ! "Checking connectivity" err
219 '
220
221 test_expect_success 'redirected submodule add --progress does show progress' '
222 git -C addtest submodule add --progress "file://$submodurl/parent" \
223 submod-redirected-progress 2>err && \
224 - grep % err
224 + test_grep % err
225 '
226
227 test_expect_success 'submodule add to .gitignored path fails' '
@@ -506,7 +506,7 @@ test_expect_success 'setup - fetch commit name from submodule' '
506
507 test_expect_success 'status should initially be "missing"' '
508 git submodule status >lines &&
509 - grep "^-$rev1" lines
509 + test_grep "^-$rev1" lines
510 '
511
512 test_expect_success 'init should register submodule url in .git/config' '
@@ -524,7 +524,7 @@ test_expect_success 'status should still be "missing" after initializing' '
524 mkdir init &&
525 git submodule status >lines &&
526 rm -fr init &&
527 - grep "^-$rev1" lines
527 + test_grep "^-$rev1" lines
528 '
529
530 test_failure_with_unknown_submodule () {
@@ -584,7 +584,7 @@ test_expect_success 'update should work when path is an empty dir' '
584
585 test_expect_success 'status should be "up-to-date" after update' '
586 git submodule status >list &&
587 - grep "^ $rev1" list
587 + test_grep "^ $rev1" list
588 '
589
590 test_expect_success 'status "up-to-date" from subdirectory' '
@@ -593,8 +593,8 @@ test_expect_success 'status "up-to-date" from subdirectory' '
593 cd sub &&
594 git submodule status >../list
595 ) &&
596 - grep "^ $rev1" list &&
597 - grep "\\.\\./init" list
596 + test_grep "^ $rev1" list &&
597 + test_grep "\\.\\./init" list
598 '
599
600 test_expect_success 'status "up-to-date" from subdirectory with path' '
@@ -603,8 +603,8 @@ test_expect_success 'status "up-to-date" from subdirectory with path' '
603 cd sub &&
604 git submodule status ../init >../list
605 ) &&
606 - grep "^ $rev1" list &&
607 - grep "\\.\\./init" list
606 + test_grep "^ $rev1" list &&
607 + test_grep "\\.\\./init" list
608 '
609
610 test_expect_success 'status should be "modified" after submodule commit' '
@@ -619,7 +619,7 @@ test_expect_success 'status should be "modified" after submodule commit' '
619 test -n "$rev2" &&
620 git submodule status >list &&
621
622 - grep "^+$rev2" list
622 + test_grep "^+$rev2" list
623 '
624
625 test_expect_success '"submodule --cached" command forms should be identical' '
@@ -634,12 +634,12 @@ test_expect_success '"submodule --cached" command forms should be identical' '
634
635 test_expect_success 'the --cached sha1 should be rev1' '
636 git submodule --cached status >list &&
637 - grep "^+$rev1" list
637 + test_grep "^+$rev1" list
638 '
639
640 test_expect_success 'git diff should report the SHA1 of the new submodule commit' '
641 git diff >diff &&
642 - grep "^+Subproject commit $rev2" diff
642 + test_grep "^+Subproject commit $rev2" diff
643 '
644
645 test_expect_success 'update should checkout rev1' '
@@ -654,7 +654,7 @@ test_expect_success 'update should checkout rev1' '
654
655 test_expect_success 'status should be "up-to-date" after update' '
656 git submodule status >list &&
657 - grep "^ $rev1" list
657 + test_grep "^ $rev1" list
658 '
659
660 test_expect_success 'checkout superproject with subproject already present' '
@@ -1407,7 +1407,7 @@ test_expect_success 'update submodules without url set in .gitconfig' '
1407 done &&
1408
1409 test_must_fail git -C multisuper_clone submodule update 2>err &&
1410 - grep "cannot clone submodule .sub[0-3]. without a URL" err
1410 + test_grep "cannot clone submodule .sub[0-3]. without a URL" err
1411 '
1412
1413 test_expect_success 'clone --recurse-submodules with a pathspec works' '
t/t7402-submodule-rebase.sh
+1 -1
@@ -125,7 +125,7 @@ test_expect_success 'rebasing submodule that should conflict' '
125 ) >expect &&
126 test_cmp expect actual &&
127 sub_expect="go to submodule (submodule), and either merge commit $(git -C submodule rev-parse --short HEAD^0)" &&
128 - grep "$sub_expect" actual_output
128 + test_grep "$sub_expect" actual_output
129 '
130
131 test_done
t/t7406-submodule-update.sh
+13 -13
@@ -627,10 +627,10 @@ test_expect_success 'submodule update - update=none in .git/config' '
627 compare_head
628 ) &&
629 git diff --name-only >out &&
630 - grep ^submodule$ out &&
630 + test_grep ^submodule$ out &&
631 git submodule update &&
632 git diff --name-only >out &&
633 - grep ^submodule$ out &&
633 + test_grep ^submodule$ out &&
634 (cd submodule &&
635 compare_head
636 ) &&
@@ -647,10 +647,10 @@ test_expect_success 'submodule update - update=none in .git/config but --checkou
647 compare_head
648 ) &&
649 git diff --name-only >out &&
650 - grep ^submodule$ out &&
650 + test_grep ^submodule$ out &&
651 git submodule update --checkout &&
652 git diff --name-only >out &&
653 - ! grep ^submodule$ out &&
653 + test_grep ! ^submodule$ out &&
654 (cd submodule &&
655 ! compare_head
656 ) &&
@@ -679,10 +679,10 @@ test_expect_success 'submodule update with pathspec warns against uninitialized
679 git submodule init submodule &&
680
681 git submodule update submodule 2>err &&
682 - ! grep "Submodule path .* not initialized" err &&
682 + test_grep ! "Submodule path .* not initialized" err &&
683
684 git submodule update rebasing 2>err &&
685 - grep "Submodule path .rebasing. not initialized" err &&
685 + test_grep "Submodule path .rebasing. not initialized" err &&
686
687 test_path_exists submodule/.git &&
688 test_path_is_missing rebasing/.git
@@ -699,7 +699,7 @@ test_expect_success 'submodule update without pathspec updates only initialized
699 git submodule update 2>err &&
700 test_path_exists submodule/.git &&
701 test_path_is_missing rebasing/.git &&
702 - ! grep "Submodule path .* not initialized" err
702 + test_grep ! "Submodule path .* not initialized" err
703 )
704
705 '
@@ -1046,12 +1046,12 @@ test_expect_success 'submodule update --recursive drops module name before recur
1046 test_expect_success 'submodule update can be run in parallel' '
1047 (cd super2 &&
1048 GIT_TRACE=$(pwd)/trace.out git submodule update --jobs 7 &&
1049 - grep "7 tasks" trace.out &&
1049 + test_grep "7 tasks" trace.out &&
1050 git config submodule.fetchJobs 8 &&
1051 GIT_TRACE=$(pwd)/trace.out git submodule update &&
1052 - grep "8 tasks" trace.out &&
1052 + test_grep "8 tasks" trace.out &&
1053 GIT_TRACE=$(pwd)/trace.out git submodule update --jobs 9 &&
1054 - grep "9 tasks" trace.out
1054 + test_grep "9 tasks" trace.out
1055 )
1056 '
1057
@@ -1066,14 +1066,14 @@ test_expect_success 'submodule update honors fetch jobs config from .gitmodules'
1066 test_expect_success 'git clone passes the parallel jobs config on to submodules' '
1067 test_when_finished "rm -rf super4" &&
1068 GIT_TRACE=$(pwd)/trace.out git clone --recurse-submodules --jobs 7 . super4 &&
1069 - grep "7 tasks" trace.out &&
1069 + test_grep "7 tasks" trace.out &&
1070 rm -rf super4 &&
1071 git config --global submodule.fetchJobs 8 &&
1072 GIT_TRACE=$(pwd)/trace.out git clone --recurse-submodules . super4 &&
1073 - grep "8 tasks" trace.out &&
1073 + test_grep "8 tasks" trace.out &&
1074 rm -rf super4 &&
1075 GIT_TRACE=$(pwd)/trace.out git clone --recurse-submodules --jobs 9 . super4 &&
1076 - grep "9 tasks" trace.out &&
1076 + test_grep "9 tasks" trace.out &&
1077 rm -rf super4
1078 '
1079
t/t7416-submodule-dash-url.sh
+10 -10
@@ -49,7 +49,7 @@ test_expect_success 'fsck rejects unprotected dash' '
49 git init --bare dst &&
50 git -C dst config transfer.fsckObjects true &&
51 test_must_fail git push dst HEAD 2>err &&
52 - grep gitmodulesUrl err
52 + test_grep gitmodulesUrl err
53 '
54
55 test_expect_success 'trailing backslash is handled correctly' '
@@ -79,7 +79,7 @@ test_expect_success 'fsck rejects missing URL scheme' '
79 git init --bare dst &&
80 git -C dst config transfer.fsckObjects true &&
81 test_must_fail git push dst HEAD 2>err &&
82 - grep gitmodulesUrl err
82 + test_grep gitmodulesUrl err
83 '
84
85 test_expect_success 'fsck rejects relative URL resolving to missing scheme' '
@@ -95,7 +95,7 @@ test_expect_success 'fsck rejects relative URL resolving to missing scheme' '
95 git init --bare dst &&
96 git -C dst config transfer.fsckObjects true &&
97 test_must_fail git push dst HEAD 2>err &&
98 - grep gitmodulesUrl err
98 + test_grep gitmodulesUrl err
99 '
100
101 test_expect_success 'fsck rejects empty URL scheme' '
@@ -111,7 +111,7 @@ test_expect_success 'fsck rejects empty URL scheme' '
111 git init --bare dst &&
112 git -C dst config transfer.fsckObjects true &&
113 test_must_fail git push dst HEAD 2>err &&
114 - grep gitmodulesUrl err
114 + test_grep gitmodulesUrl err
115 '
116
117 test_expect_success 'fsck rejects relative URL resolving to empty scheme' '
@@ -127,7 +127,7 @@ test_expect_success 'fsck rejects relative URL resolving to empty scheme' '
127 git init --bare dst &&
128 git -C dst config transfer.fsckObjects true &&
129 test_must_fail git push dst HEAD 2>err &&
130 - grep gitmodulesUrl err
130 + test_grep gitmodulesUrl err
131 '
132
133 test_expect_success 'fsck rejects empty hostname' '
@@ -143,7 +143,7 @@ test_expect_success 'fsck rejects empty hostname' '
143 git init --bare dst &&
144 git -C dst config transfer.fsckObjects true &&
145 test_must_fail git push dst HEAD 2>err &&
146 - grep gitmodulesUrl err
146 + test_grep gitmodulesUrl err
147 '
148
149 test_expect_success 'fsck rejects relative url that produced empty hostname' '
@@ -159,7 +159,7 @@ test_expect_success 'fsck rejects relative url that produced empty hostname' '
159 git init --bare dst &&
160 git -C dst config transfer.fsckObjects true &&
161 test_must_fail git push dst HEAD 2>err &&
162 - grep gitmodulesUrl err
162 + test_grep gitmodulesUrl err
163 '
164
165 test_expect_success 'fsck permits embedded newline with unrecognized scheme' '
@@ -189,7 +189,7 @@ test_expect_success 'fsck rejects embedded newline in url' '
189 git init --bare dst &&
190 git -C dst config transfer.fsckObjects true &&
191 test_must_fail git push dst HEAD 2>err &&
192 - grep gitmodulesUrl err
192 + test_grep gitmodulesUrl err
193 '
194
195 test_expect_success 'fsck rejects embedded newline in relative url' '
@@ -204,7 +204,7 @@ test_expect_success 'fsck rejects embedded newline in relative url' '
204 git init --bare dst &&
205 git -C dst config transfer.fsckObjects true &&
206 test_must_fail git push dst HEAD 2>err &&
207 - grep gitmodulesUrl err
207 + test_grep gitmodulesUrl err
208 '
209
210 test_expect_success 'fsck rejects embedded newline in git url' '
@@ -219,7 +219,7 @@ test_expect_success 'fsck rejects embedded newline in git url' '
219 git init --bare dst &&
220 git -C dst config transfer.fsckObjects true &&
221 test_must_fail git push dst HEAD 2>err &&
222 - grep gitmodulesUrl err
222 + test_grep gitmodulesUrl err
223 '
224
225 test_done
t/t7417-submodule-path-url.sh
+1 -1
@@ -29,7 +29,7 @@ test_expect_success 'fsck rejects unprotected dash' '
29 git init --bare dst &&
30 git -C dst config transfer.fsckObjects true &&
31 test_must_fail git push dst HEAD 2>err &&
32 - grep gitmodulesPath err
32 + test_grep gitmodulesPath err
33 '
34
35 test_expect_success MINGW 'submodule paths disallows trailing spaces' '
t/t7450-bad-git-dotfiles.sh
+13 -7
@@ -109,7 +109,7 @@ test_expect_success 'add other submodule' '
109
110 test_expect_success 'clone evil superproject' '
111 git clone --recurse-submodules . victim >output 2>&1 &&
112 - ! grep "RUNNING POST CHECKOUT" output
112 + test_grep ! "RUNNING POST CHECKOUT" output
113 '
114
115 test_expect_success 'fsck detects evil superproject' '
@@ -167,7 +167,7 @@ test_expect_success 'index-pack --strict works for non-repo pack' '
167 test_must_fail git -C dst.git index-pack --strict odd.pack 2>output &&
168 # Make sure we fail due to bad gitmodules content, not because we
169 # could not read the blob in the first place.
170 - grep gitmodulesName output
170 + test_grep gitmodulesName output
171 '
172
173 check_dotx_symlink () {
@@ -216,7 +216,7 @@ check_dotx_symlink () {
216 # Check not only that we fail, but that it is due to the
217 # symlink detector
218 $fsck_must_fail git fsck 2>output &&
219 - grep "$fsck_prefix.*tree $tree: ${name}Symlink" output
219 + test_grep "$fsck_prefix.*tree $tree: ${name}Symlink" output
220 )
221 '
222
@@ -228,7 +228,7 @@ check_dotx_symlink () {
228 -c core.protectntfs \
229 -c core.protecthfs \
230 read-tree $tree 2>err &&
231 - grep "invalid path.*$name" err &&
231 + test_grep "invalid path.*$name" err &&
232 git -C $dir ls-files -s >out &&
233 test_must_be_empty out
234 '
@@ -317,7 +317,13 @@ test_expect_success WINDOWS 'prevent git~1 squatting on Windows' '
317 test_must_fail git -c core.protectNTFS=false \
318 clone --recurse-submodules squatting squatting-clone 2>err &&
319 test_grep -e "directory not empty" -e "not an empty directory" err &&
320 - ! grep gitdir squatting-clone/d/a/git~2
320 + # git~2 is an 8.3 short name, present only when 8.3 name
321 + # generation is enabled. The "directory not empty" check
322 + # above is the primary assertion.
323 + if test -f squatting-clone/d/a/git~2
324 + then
325 + test_grep ! gitdir squatting-clone/d/a/git~2
326 + fi
327 fi
328 '
329
@@ -350,7 +356,7 @@ test_expect_success 'git dirs of sibling submodules must not be nested' '
356 test_expect_success 'submodule git dir nesting detection must work with parallel cloning' '
357 test_must_fail git clone --recurse-submodules --jobs=2 nested clone_parallel 2>err &&
358 cat err &&
353 - grep -E "(already exists|is inside git dir|not a git repository)" err &&
359 + test_grep -E "(already exists|is inside git dir|not a git repository)" err &&
360 {
361 test_path_is_missing .git/modules/hippo/HEAD ||
362 test_path_is_missing .git/modules/hippo/hooks/HEAD
@@ -370,7 +376,7 @@ test_expect_success 'checkout -f --recurse-submodules must not use a nested gitd
376 ) &&
377 test_must_fail git -C nested_checkout checkout -f --recurse-submodules HEAD 2>err &&
378 cat err &&
373 - grep "is inside git dir" err &&
379 + test_grep "is inside git dir" err &&
380 test_path_is_missing nested_checkout/thing2/.git
381 '
382
t/t7501-commit-basic-functionality.sh
+8 -8
@@ -342,12 +342,12 @@ test_expect_success 'overriding author from command line' '
342 echo gak >file &&
343 git commit -m author \
344 --author "Rubber Duck <rduck@convoy.org>" -a >output 2>&1 &&
345 - grep Rubber.Duck output
345 + test_grep Rubber.Duck output
346 '
347
348 test_expect_success 'interactive add' '
349 echo 7 | test_must_fail git commit --interactive >out &&
350 - grep "What now" out
350 + test_grep "What now" out
351 '
352
353 test_expect_success "commit --interactive doesn't change index if editor aborts" '
@@ -376,13 +376,13 @@ test_expect_success 'editor not invoked if -F is given' '
376
377 EDITOR=./editor git commit -a -F msg &&
378 git show -s --pretty=format:%s >subject &&
379 - grep -q good subject &&
379 + test_grep -q good subject &&
380
381 echo quack >file &&
382 echo Another good message. |
383 EDITOR=./editor git commit -a -F - &&
384 git show -s --pretty=format:%s >subject &&
385 - grep -q good subject
385 + test_grep -q good subject
386 '
387
388 test_expect_success 'partial commit that involves removal (1)' '
@@ -471,7 +471,7 @@ test_expect_success 'amend does not add signoff if it already exists' '
471
472 test_expect_success 'commit mentions forced date in output' '
473 git commit --amend --date=2010-01-02T03:04:05 >output &&
474 - grep "Date: *Sat Jan 2 03:04:05 2010" output
474 + test_grep "Date: *Sat Jan 2 03:04:05 2010" output
475 '
476
477 test_expect_success 'commit complains about completely bogus dates' '
@@ -660,9 +660,9 @@ test_expect_success 'git commit <file> with dirty index' '
660 git add chz &&
661 git commit elif -m "tacocat is a palindrome" &&
662 git show --stat >stat &&
663 - grep elif stat &&
663 + test_grep elif stat &&
664 git diff --cached >diff &&
665 - grep chz diff
665 + test_grep chz diff
666 '
667
668 test_expect_success 'same tree (single parent)' '
@@ -676,7 +676,7 @@ test_expect_success 'same tree (single parent) --allow-empty' '
676
677 git commit --allow-empty -m "forced empty" &&
678 git cat-file commit HEAD >commit &&
679 - grep forced commit
679 + test_grep forced commit
680
681 '
682
t/t7502-commit-porcelain.sh
+1 -1
@@ -529,7 +529,7 @@ test_expect_success 'verbose respects diff config' '
529
530 test_config diff.noprefix true &&
531 git status -v >actual &&
532 - grep "diff --git negative negative" actual
532 + test_grep "diff --git negative negative" actual
533 '
534
535 mesg_with_comment_and_newlines='
t/t7507-commit-verbose.sh
+3 -3
@@ -106,13 +106,13 @@ test_expect_success 'verbose diff is stripped with multi-byte comment char' '
106 export GIT_EDITOR &&
107 test_must_fail git -c core.commentchar="foo>" commit -a -v >out 2>err
108 ) &&
109 - grep "^foo> " out &&
109 + test_grep "^foo> " out &&
110 test_grep "Aborting commit due to empty commit message." err
111 '
112
113 test_expect_success 'status does not verbose without --verbose' '
114 git status >actual &&
115 - ! grep "^diff --git" actual
115 + test_grep ! "^diff --git" actual
116 '
117
118 test_expect_success 'setup -v -v' '
@@ -163,7 +163,7 @@ done
163
164 test_expect_success "status ignores commit.verbose=true" '
165 git -c commit.verbose=true status >actual &&
166 - ! grep "^diff --git" actual
166 + test_grep ! "^diff --git" actual
167 '
168
169 test_done
t/t7508-status.sh
+3 -3
@@ -863,7 +863,7 @@ test_expect_success 'status -s without relative paths' '
863 test_cmp expect output &&
864
865 git status -s --ignored >output &&
866 - grep "^!! \"expect with spaces\"$" output &&
866 + test_grep "^!! \"expect with spaces\"$" output &&
867 grep -v "^!! " output >output-wo-ignored &&
868 test_cmp expect output-wo-ignored
869 '
@@ -908,7 +908,7 @@ test_expect_success 'status shows detached HEAD properly after checking out non-
908 git clone upstream downstream &&
909 git -C downstream checkout @{u} &&
910 git -C downstream status >actual &&
911 - grep -E "HEAD detached at [0-9a-f]+" actual
911 + test_grep -E "HEAD detached at [0-9a-f]+" actual
912 '
913
914 test_expect_success 'setup status submodule summary' '
@@ -1127,7 +1127,7 @@ test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository'
1127 # make dir1/tracked stat-dirty
1128 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
1129 git status -s >output &&
1130 - ! grep dir1/tracked output &&
1130 + test_grep ! dir1/tracked output &&
1131 # make sure "status" succeeded without writing index out
1132 git diff-files | grep dir1/tracked
1133 )
t/t7510-signed-commit.sh
+34 -34
@@ -89,8 +89,8 @@ test_expect_success GPG 'verify and show signatures' '
89 do
90 git verify-commit $commit &&
91 git show --pretty=short --show-signature $commit >actual &&
92 - grep "Good signature from" actual &&
93 - ! grep "BAD signature from" actual &&
92 + test_grep "Good signature from" actual &&
93 + test_grep ! "BAD signature from" actual &&
94 echo $commit OK || exit 1
95 done
96 ) &&
@@ -100,8 +100,8 @@ test_expect_success GPG 'verify and show signatures' '
100 do
101 test_must_fail git verify-commit $commit &&
102 git show --pretty=short --show-signature $commit >actual &&
103 - ! grep "Good signature from" actual &&
104 - ! grep "BAD signature from" actual &&
103 + test_grep ! "Good signature from" actual &&
104 + test_grep ! "BAD signature from" actual &&
105 echo $commit OK || exit 1
106 done
107 ) &&
@@ -109,9 +109,9 @@ test_expect_success GPG 'verify and show signatures' '
109 for commit in eighth-signed-alt twelfth-signed-alt
110 do
111 git show --pretty=short --show-signature $commit >actual &&
112 - grep "Good signature from" actual &&
113 - ! grep "BAD signature from" actual &&
114 - grep "not certified" actual &&
112 + test_grep "Good signature from" actual &&
113 + test_grep ! "BAD signature from" actual &&
114 + test_grep "not certified" actual &&
115 echo $commit OK || exit 1
116 done
117 )
@@ -119,16 +119,16 @@ test_expect_success GPG 'verify and show signatures' '
119
120 test_expect_success GPG 'verify-commit exits failure on unknown signature' '
121 test_must_fail env GNUPGHOME="$GNUPGHOME_NOT_USED" git verify-commit initial 2>actual &&
122 - ! grep "Good signature from" actual &&
123 - ! grep "BAD signature from" actual &&
124 - grep -q -F -e "No public key" -e "public key not found" actual
122 + test_grep ! "Good signature from" actual &&
123 + test_grep ! "BAD signature from" actual &&
124 + test_grep -q -F -e "No public key" -e "public key not found" actual
125 '
126
127 test_expect_success GPG 'verify-commit exits success on untrusted signature' '
128 git verify-commit eighth-signed-alt 2>actual &&
129 - grep "Good signature from" actual &&
130 - ! grep "BAD signature from" actual &&
131 - grep "not certified" actual
129 + test_grep "Good signature from" actual &&
130 + test_grep ! "BAD signature from" actual &&
131 + test_grep "not certified" actual
132 '
133
134 test_expect_success GPG 'verify-commit exits success with matching minTrustLevel' '
@@ -151,8 +151,8 @@ test_expect_success GPG 'verify signatures with --raw' '
151 for commit in initial second merge fourth-signed fifth-signed sixth-signed seventh-signed
152 do
153 git verify-commit --raw $commit 2>actual &&
154 - grep "GOODSIG" actual &&
155 - ! grep "BADSIG" actual &&
154 + test_grep "GOODSIG" actual &&
155 + test_grep ! "BADSIG" actual &&
156 echo $commit OK || exit 1
157 done
158 ) &&
@@ -160,8 +160,8 @@ test_expect_success GPG 'verify signatures with --raw' '
160 for commit in merge^2 fourth-unsigned sixth-unsigned seventh-unsigned
161 do
162 test_must_fail git verify-commit --raw $commit 2>actual &&
163 - ! grep "GOODSIG" actual &&
164 - ! grep "BADSIG" actual &&
163 + test_grep ! "GOODSIG" actual &&
164 + test_grep ! "BADSIG" actual &&
165 echo $commit OK || exit 1
166 done
167 ) &&
@@ -169,9 +169,9 @@ test_expect_success GPG 'verify signatures with --raw' '
169 for commit in eighth-signed-alt
170 do
171 git verify-commit --raw $commit 2>actual &&
172 - grep "GOODSIG" actual &&
173 - ! grep "BADSIG" actual &&
174 - grep "TRUST_UNDEFINED" actual &&
172 + test_grep "GOODSIG" actual &&
173 + test_grep ! "BADSIG" actual &&
174 + test_grep "TRUST_UNDEFINED" actual &&
175 echo $commit OK || exit 1
176 done
177 )
@@ -179,7 +179,7 @@ test_expect_success GPG 'verify signatures with --raw' '
179
180 test_expect_success GPG 'proper header is used for hash algorithm' '
181 git cat-file commit fourth-signed >output &&
182 - grep "^$(test_oid header) -----BEGIN PGP SIGNATURE-----" output
182 + test_grep "^$(test_oid header) -----BEGIN PGP SIGNATURE-----" output
183 '
184
185 test_expect_success GPG 'show signed commit with signature' '
@@ -201,8 +201,8 @@ test_expect_success GPG 'detect fudged signature' '
201 git hash-object -w -t commit forged1 >forged1.commit &&
202 test_must_fail git verify-commit $(cat forged1.commit) &&
203 git show --pretty=short --show-signature $(cat forged1.commit) >actual1 &&
204 - grep "BAD signature from" actual1 &&
205 - ! grep "Good signature from" actual1
204 + test_grep "BAD signature from" actual1 &&
205 + test_grep ! "Good signature from" actual1
206 '
207
208 test_expect_success GPG 'detect fudged signature with NUL' '
@@ -212,8 +212,8 @@ test_expect_success GPG 'detect fudged signature with NUL' '
212 git hash-object --literally -w -t commit forged2 >forged2.commit &&
213 test_must_fail git verify-commit $(cat forged2.commit) &&
214 git show --pretty=short --show-signature $(cat forged2.commit) >actual2 &&
215 - grep "BAD signature from" actual2 &&
216 - ! grep "Good signature from" actual2
215 + test_grep "BAD signature from" actual2 &&
216 + test_grep ! "Good signature from" actual2
217 '
218
219 test_expect_success GPG 'amending already signed commit' '
@@ -221,8 +221,8 @@ test_expect_success GPG 'amending already signed commit' '
221 git commit --amend -S --no-edit &&
222 git verify-commit HEAD &&
223 git show -s --show-signature HEAD >actual &&
224 - grep "Good signature from" actual &&
225 - ! grep "BAD signature from" actual
224 + test_grep "Good signature from" actual &&
225 + test_grep ! "BAD signature from" actual
226 '
227
228 test_expect_success GPG2 'bare signature' '
@@ -326,8 +326,8 @@ test_expect_success GPG 'show lack of signature with custom format' '
326 test_expect_success GPG 'log.showsignature behaves like --show-signature' '
327 test_config log.showsignature true &&
328 git show initial >actual &&
329 - grep "gpg: Signature made" actual &&
330 - grep "gpg: Good signature" actual
329 + test_grep "gpg: Signature made" actual &&
330 + test_grep "gpg: Good signature" actual
331 '
332
333 test_expect_success GPG 'check config gpg.format values' '
@@ -349,8 +349,8 @@ test_expect_success GPG 'detect fudged commit with double signature' '
349 git hash-object -w -t commit double-commit >double-commit.commit &&
350 test_must_fail git verify-commit $(cat double-commit.commit) &&
351 git show --pretty=short --show-signature $(cat double-commit.commit) >double-actual &&
352 - grep "BAD signature from" double-actual &&
353 - grep "Good signature from" double-actual
352 + test_grep "BAD signature from" double-actual &&
353 + test_grep "Good signature from" double-actual
354 '
355
356 test_expect_success GPG 'show double signature with custom format' '
@@ -404,8 +404,8 @@ test_expect_success GPG 'verify-commit verifies multiply signed commits' '
404 head=$(git hash-object -t commit -w commit) &&
405 git reset --hard $head &&
406 git verify-commit $head 2>actual &&
407 - grep "Good signature from" actual &&
408 - ! grep "BAD signature from" actual
407 + test_grep "Good signature from" actual &&
408 + test_grep ! "BAD signature from" actual
409 '
410
411 test_expect_success 'custom `gpg.program`' '
@@ -449,7 +449,7 @@ test_expect_success 'custom `gpg.program`' '
449
450 test_must_fail env LET_GPG_PROGRAM_FAIL=1 \
451 git commit -S --allow-empty -m must-fail 2>err &&
452 - grep zOMG err &&
452 + test_grep zOMG err &&
453
454 # `gpg.program` starts with `~`, the path should be interpreted to be relative to `$HOME`
455 test_config gpg.program "~/fake-gpg" &&
t/t7516-commit-races.sh
+2 -2
@@ -10,7 +10,7 @@ test_expect_success 'race to create orphan commit' '
10 EOF
11 test_must_fail env EDITOR=./hare-editor git commit --allow-empty -m tortoise -e &&
12 git show -s --pretty=format:%s >subject &&
13 - grep hare subject &&
13 + test_grep hare subject &&
14 git show -s --pretty=format:%P >out &&
15 test_must_be_empty out
16 '
@@ -24,7 +24,7 @@ test_expect_success 'race to create non-orphan commit' '
24 git rev-parse HEAD >base &&
25 test_must_fail env EDITOR=./airplane-editor git commit --allow-empty -m ship -e &&
26 git show -s --pretty=format:%s >subject &&
27 - grep airplane subject &&
27 + test_grep airplane subject &&
28 git rev-parse HEAD^ >parent &&
29 test_cmp base parent
30 '
t/t7519-status-fsmonitor.sh
+7 -7
@@ -63,19 +63,19 @@ test_expect_success 'incompatible bare repo' '
63 test_must_fail \
64 git -C ./bare-clone -c core.fsmonitor=foo \
65 update-index --fsmonitor 2>actual &&
66 - grep "bare repository .* is incompatible with fsmonitor" actual &&
66 + test_grep "bare repository .* is incompatible with fsmonitor" actual &&
67
68 test_must_fail \
69 git -C ./bare-clone -c core.fsmonitor=true \
70 update-index --fsmonitor 2>actual &&
71 - grep "bare repository .* is incompatible with fsmonitor" actual
71 + test_grep "bare repository .* is incompatible with fsmonitor" actual
72 '
73
74 test_expect_success FSMONITOR_DAEMON 'run fsmonitor-daemon in bare repo' '
75 test_when_finished "rm -rf ./bare-clone actual" &&
76 git init --bare bare-clone &&
77 test_must_fail git -C ./bare-clone fsmonitor--daemon run 2>actual &&
78 - grep "bare repository .* is incompatible with fsmonitor" actual
78 + test_grep "bare repository .* is incompatible with fsmonitor" actual
79 '
80
81 test_expect_success MINGW,FSMONITOR_DAEMON 'run fsmonitor-daemon in virtual repo' '
@@ -84,7 +84,7 @@ test_expect_success MINGW,FSMONITOR_DAEMON 'run fsmonitor-daemon in virtual repo
84 test_must_fail git -C ./fake-virtual-clone \
85 -c core.virtualfilesystem=true \
86 fsmonitor--daemon run 2>actual &&
87 - grep "virtual repository .* is incompatible with fsmonitor" actual
87 + test_grep "virtual repository .* is incompatible with fsmonitor" actual
88 '
89
90 test_expect_success 'setup' '
@@ -111,21 +111,21 @@ test_expect_success 'setup' '
111 # test that the fsmonitor extension is off by default
112 test_expect_success 'fsmonitor extension is off by default' '
113 test-tool dump-fsmonitor >actual &&
114 - grep "^no fsmonitor" actual
114 + test_grep "^no fsmonitor" actual
115 '
116
117 # test that "update-index --fsmonitor" adds the fsmonitor extension
118 test_expect_success 'update-index --fsmonitor" adds the fsmonitor extension' '
119 git update-index --fsmonitor &&
120 test-tool dump-fsmonitor >actual &&
121 - grep "^fsmonitor last update" actual
121 + test_grep "^fsmonitor last update" actual
122 '
123
124 # test that "update-index --no-fsmonitor" removes the fsmonitor extension
125 test_expect_success 'update-index --no-fsmonitor" removes the fsmonitor extension' '
126 git update-index --no-fsmonitor &&
127 test-tool dump-fsmonitor >actual &&
128 - grep "^no fsmonitor" actual
128 + test_grep "^no fsmonitor" actual
129 '
130
131 cat >expect <<EOF &&
t/t7527-builtin-fsmonitor.sh
+41 -41
@@ -157,7 +157,7 @@ test_expect_success 'implicit daemon start' '
157 GIT_TRACE2_EVENT="$PWD/.git/trace" \
158 test-tool -C test_implicit fsmonitor-client query --token 0 >actual &&
159 nul_to_q <actual >actual.filtered &&
160 - grep "builtin:" actual.filtered &&
160 + test_grep "builtin:" actual.filtered &&
161
162 # confirm that a daemon was started in the background.
163 #
@@ -311,7 +311,7 @@ test_expect_success 'cannot start multiple daemons' '
311 start_daemon -C test_multiple &&
312
313 test_must_fail git -C test_multiple fsmonitor--daemon start 2>actual &&
314 - grep "fsmonitor--daemon is already running" actual &&
314 + test_grep "fsmonitor--daemon is already running" actual &&
315
316 git -C test_multiple fsmonitor--daemon stop &&
317 test_must_fail git -C test_multiple fsmonitor--daemon status
@@ -621,7 +621,7 @@ test_expect_success 'flush cached data' '
621 test-tool -C test_flush fsmonitor-client query --token "builtin:test_00000001:0" >actual_1 &&
622 nul_to_q <actual_1 >actual_q1 &&
623
624 - grep "file_1" actual_q1 &&
624 + test_grep "file_1" actual_q1 &&
625
626 # Force a flush. This will change the <token_id>, reset the <seq_nr>, and
627 # flush the file data. Then create some events and ensure that the file
@@ -629,19 +629,19 @@ test_expect_success 'flush cached data' '
629
630 test-tool -C test_flush fsmonitor-client flush >flush_0 &&
631 nul_to_q <flush_0 >flush_q0 &&
632 - grep "^builtin:test_00000002:0Q/Q$" flush_q0 &&
632 + test_grep "^builtin:test_00000002:0Q/Q$" flush_q0 &&
633
634 test-tool -C test_flush fsmonitor-client query --token "builtin:test_00000002:0" >actual_2 &&
635 nul_to_q <actual_2 >actual_q2 &&
636
637 - grep "^builtin:test_00000002:0Q$" actual_q2 &&
637 + test_grep "^builtin:test_00000002:0Q$" actual_q2 &&
638
639 >test_flush/file_3 &&
640
641 test-tool -C test_flush fsmonitor-client query --token "builtin:test_00000002:0" >actual_3 &&
642 nul_to_q <actual_3 >actual_q3 &&
643
644 - grep "file_3" actual_q3
644 + test_grep "file_3" actual_q3
645 '
646
647 # The next few test cases create repos where the .git directory is NOT
@@ -814,7 +814,7 @@ do
814
815 start_daemon -C "$u" &&
816 git -C "$u" status >actual &&
817 - grep "new file: file1" actual
817 + test_grep "new file: file1" actual
818 '
819 done
820
@@ -1068,9 +1068,9 @@ test_expect_success CASE_INSENSITIVE_FS 'case insensitive+preserving' '
1068 # directories and files that we touched. We may or may not get a
1069 # trailing slash on modified directories.
1070 #
1071 - grep -E "^event: abc/?$" ./insensitive.trace &&
1072 - grep -E "^event: abc/def/?$" ./insensitive.trace &&
1073 - grep -E "^event: abc/def/xyz$" ./insensitive.trace
1071 + test_grep -E "^event: abc/?$" ./insensitive.trace &&
1072 + test_grep -E "^event: abc/def/?$" ./insensitive.trace &&
1073 + test_grep -E "^event: abc/def/xyz$" ./insensitive.trace
1074 '
1075
1076 # The variable "unicode_debug" is defined in the following library
@@ -1112,20 +1112,20 @@ test_expect_success !UNICODE_COMPOSITION_SENSITIVE 'Unicode nfc/nfd' '
1112 then
1113 # We should have seen NFC event from OS.
1114 # We should not have synthesized an NFD event.
1115 - grep -E "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace &&
1116 - grep -E -v "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace
1115 + test_grep -E "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace &&
1116 + test_grep -E -v "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace
1117 else
1118 # We should have seen NFD event from OS.
1119 # We should have synthesized an NFC event.
1120 - grep -E "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace &&
1121 - grep -E "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace
1120 + test_grep -E "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace &&
1121 + test_grep -E "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace
1122 fi &&
1123
1124 # We assume UNICODE_NFD_PRESERVED.
1125 # We should have seen explicit NFD from OS.
1126 # We should have synthesized an NFC event.
1127 - grep -E "^event: nfd/d_${utf8_nfd}/?$" ./unicode.trace &&
1128 - grep -E "^event: nfd/d_${utf8_nfc}/?$" ./unicode.trace
1127 + test_grep -E "^event: nfd/d_${utf8_nfd}/?$" ./unicode.trace &&
1128 + test_grep -E "^event: nfd/d_${utf8_nfc}/?$" ./unicode.trace
1129 '
1130
1131 test_expect_success 'split-index and FSMonitor work well together' '
@@ -1239,21 +1239,21 @@ test_expect_success CASE_INSENSITIVE_FS 'fsmonitor subdir case wrong on disk' '
1239 <"$PWD/subdir_case_wrong.log" \
1240 >"$PWD/subdir_case_wrong.log1" &&
1241
1242 - grep -q "AAA.*pos 0" "$PWD/subdir_case_wrong.log1" &&
1243 - grep -q "zzz.*pos 6" "$PWD/subdir_case_wrong.log1" &&
1242 + test_grep -q "AAA.*pos 0" "$PWD/subdir_case_wrong.log1" &&
1243 + test_grep -q "zzz.*pos 6" "$PWD/subdir_case_wrong.log1" &&
1244
1245 - grep -q "dir1/DIR2/dir3/file3.*pos -3" "$PWD/subdir_case_wrong.log1" &&
1245 + test_grep -q "dir1/DIR2/dir3/file3.*pos -3" "$PWD/subdir_case_wrong.log1" &&
1246
1247 # Verify that we get a mapping event to correct the case.
1248 - grep -q "MAP:.*dir1/DIR2/dir3/file3.*dir1/dir2/dir3/file3" \
1248 + test_grep -q "MAP:.*dir1/DIR2/dir3/file3.*dir1/dir2/dir3/file3" \
1249 "$PWD/subdir_case_wrong.log1" &&
1250
1251 # The refresh-callbacks should have caused "git status" to clear
1252 # the CE_FSMONITOR_VALID bit on each of those files and caused
1253 # the worktree scan to visit them and mark them as modified.
1254 - grep -q " M AAA" "$PWD/subdir_case_wrong.out" &&
1255 - grep -q " M zzz" "$PWD/subdir_case_wrong.out" &&
1256 - grep -q " M dir1/dir2/dir3/file3" "$PWD/subdir_case_wrong.out"
1254 + test_grep -q " M AAA" "$PWD/subdir_case_wrong.out" &&
1255 + test_grep -q " M zzz" "$PWD/subdir_case_wrong.out" &&
1256 + test_grep -q " M dir1/dir2/dir3/file3" "$PWD/subdir_case_wrong.out"
1257 '
1258
1259 test_expect_success CASE_INSENSITIVE_FS 'fsmonitor file case wrong on disk' '
@@ -1326,10 +1326,10 @@ test_expect_success CASE_INSENSITIVE_FS 'fsmonitor file case wrong on disk' '
1326 GIT_TRACE_FSMONITOR="$PWD/file_case_wrong-try1.log" \
1327 git -C file_case_wrong status --short \
1328 >"$PWD/file_case_wrong-try1.out" &&
1329 - grep -q "fsmonitor_refresh_callback.*FILE-3-A.*pos -3" "$PWD/file_case_wrong-try1.log" &&
1330 - grep -q "fsmonitor_refresh_callback.*file-3-a.*pos 4" "$PWD/file_case_wrong-try1.log" &&
1331 - grep -q "fsmonitor_refresh_callback.*FILE-4-A.*pos 6" "$PWD/file_case_wrong-try1.log" &&
1332 - grep -q "fsmonitor_refresh_callback.*file-4-a.*pos -9" "$PWD/file_case_wrong-try1.log" &&
1329 + test_grep -q "fsmonitor_refresh_callback.*FILE-3-A.*pos -3" "$PWD/file_case_wrong-try1.log" &&
1330 + test_grep -q "fsmonitor_refresh_callback.*file-3-a.*pos 4" "$PWD/file_case_wrong-try1.log" &&
1331 + test_grep -q "fsmonitor_refresh_callback.*FILE-4-A.*pos 6" "$PWD/file_case_wrong-try1.log" &&
1332 + test_grep -q "fsmonitor_refresh_callback.*file-4-a.*pos -9" "$PWD/file_case_wrong-try1.log" &&
1333
1334 # FSM refresh will have invalidated the FSM bit and cause a regular
1335 # (real) scan of these tracked files, so they should have "H" status.
@@ -1337,8 +1337,8 @@ test_expect_success CASE_INSENSITIVE_FS 'fsmonitor file case wrong on disk' '
1337 # command).)
1338
1339 git -C file_case_wrong ls-files -f >"$PWD/file_case_wrong-lsf1.out" &&
1340 - grep -q "H dir1/dir2/dir3/file-3-a" "$PWD/file_case_wrong-lsf1.out" &&
1341 - grep -q "H dir1/dir2/dir4/FILE-4-A" "$PWD/file_case_wrong-lsf1.out" &&
1340 + test_grep -q "H dir1/dir2/dir3/file-3-a" "$PWD/file_case_wrong-lsf1.out" &&
1341 + test_grep -q "H dir1/dir2/dir4/FILE-4-A" "$PWD/file_case_wrong-lsf1.out" &&
1342
1343
1344 # Try the status again. We assume that the above status command
@@ -1347,17 +1347,17 @@ test_expect_success CASE_INSENSITIVE_FS 'fsmonitor file case wrong on disk' '
1347 GIT_TRACE_FSMONITOR="$PWD/file_case_wrong-try2.log" \
1348 git -C file_case_wrong status --short \
1349 >"$PWD/file_case_wrong-try2.out" &&
1350 - ! grep -q "fsmonitor_refresh_callback.*FILE-3-A.*pos" "$PWD/file_case_wrong-try2.log" &&
1351 - ! grep -q "fsmonitor_refresh_callback.*file-3-a.*pos" "$PWD/file_case_wrong-try2.log" &&
1352 - ! grep -q "fsmonitor_refresh_callback.*FILE-4-A.*pos" "$PWD/file_case_wrong-try2.log" &&
1353 - ! grep -q "fsmonitor_refresh_callback.*file-4-a.*pos" "$PWD/file_case_wrong-try2.log" &&
1350 + test_grep ! -q "fsmonitor_refresh_callback.*FILE-3-A.*pos" "$PWD/file_case_wrong-try2.log" &&
1351 + test_grep ! -q "fsmonitor_refresh_callback.*file-3-a.*pos" "$PWD/file_case_wrong-try2.log" &&
1352 + test_grep ! -q "fsmonitor_refresh_callback.*FILE-4-A.*pos" "$PWD/file_case_wrong-try2.log" &&
1353 + test_grep ! -q "fsmonitor_refresh_callback.*file-4-a.*pos" "$PWD/file_case_wrong-try2.log" &&
1354
1355 # FSM refresh saw nothing, so it will mark all files as valid,
1356 # so they should now have "h" status.
1357
1358 git -C file_case_wrong ls-files -f >"$PWD/file_case_wrong-lsf2.out" &&
1359 - grep -q "h dir1/dir2/dir3/file-3-a" "$PWD/file_case_wrong-lsf2.out" &&
1360 - grep -q "h dir1/dir2/dir4/FILE-4-A" "$PWD/file_case_wrong-lsf2.out" &&
1359 + test_grep -q "h dir1/dir2/dir3/file-3-a" "$PWD/file_case_wrong-lsf2.out" &&
1360 + test_grep -q "h dir1/dir2/dir4/FILE-4-A" "$PWD/file_case_wrong-lsf2.out" &&
1361
1362
1363 # We now have files with clean content, but with case-incorrect
@@ -1372,20 +1372,20 @@ test_expect_success CASE_INSENSITIVE_FS 'fsmonitor file case wrong on disk' '
1372 >"$PWD/file_case_wrong-try3.out" &&
1373
1374 # Verify that we get a mapping event to correct the case.
1375 - grep -q "fsmonitor_refresh_callback MAP:.*dir1/dir2/dir3/FILE-3-A.*dir1/dir2/dir3/file-3-a" \
1375 + test_grep -q "fsmonitor_refresh_callback MAP:.*dir1/dir2/dir3/FILE-3-A.*dir1/dir2/dir3/file-3-a" \
1376 "$PWD/file_case_wrong-try3.log" &&
1377 - grep -q "fsmonitor_refresh_callback MAP:.*dir1/dir2/dir4/file-4-a.*dir1/dir2/dir4/FILE-4-A" \
1377 + test_grep -q "fsmonitor_refresh_callback MAP:.*dir1/dir2/dir4/file-4-a.*dir1/dir2/dir4/FILE-4-A" \
1378 "$PWD/file_case_wrong-try3.log" &&
1379
1380 # FSEvents are in observed case.
1381 - grep -q "fsmonitor_refresh_callback.*FILE-3-A.*pos -3" "$PWD/file_case_wrong-try3.log" &&
1382 - grep -q "fsmonitor_refresh_callback.*file-4-a.*pos -9" "$PWD/file_case_wrong-try3.log" &&
1381 + test_grep -q "fsmonitor_refresh_callback.*FILE-3-A.*pos -3" "$PWD/file_case_wrong-try3.log" &&
1382 + test_grep -q "fsmonitor_refresh_callback.*file-4-a.*pos -9" "$PWD/file_case_wrong-try3.log" &&
1383
1384 # The refresh-callbacks should have caused "git status" to clear
1385 # the CE_FSMONITOR_VALID bit on each of those files and caused
1386 # the worktree scan to visit them and mark them as modified.
1387 - grep -q " M dir1/dir2/dir3/file-3-a" "$PWD/file_case_wrong-try3.out" &&
1388 - grep -q " M dir1/dir2/dir4/FILE-4-A" "$PWD/file_case_wrong-try3.out"
1387 + test_grep -q " M dir1/dir2/dir3/file-3-a" "$PWD/file_case_wrong-try3.out" &&
1388 + test_grep -q " M dir1/dir2/dir4/FILE-4-A" "$PWD/file_case_wrong-try3.out"
1389 '
1390
1391 test_done
t/t7528-signed-commit-ssh.sh
+34 -34
@@ -133,8 +133,8 @@ test_expect_success GPGSSH 'verify and show signatures' '
133 do
134 git verify-commit $commit &&
135 git show --pretty=short --show-signature $commit >actual &&
136 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
137 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
136 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
137 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
138 echo $commit OK || exit 1
139 done
140 ) &&
@@ -144,8 +144,8 @@ test_expect_success GPGSSH 'verify and show signatures' '
144 do
145 test_must_fail git verify-commit $commit &&
146 git show --pretty=short --show-signature $commit >actual &&
147 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
148 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
147 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
148 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
149 echo $commit OK || exit 1
150 done
151 ) &&
@@ -153,9 +153,9 @@ test_expect_success GPGSSH 'verify and show signatures' '
153 for commit in eighth-signed-alt twelfth-signed-alt
154 do
155 git show --pretty=short --show-signature $commit >actual &&
156 - grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
157 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
158 - grep "${GPGSSH_KEY_NOT_TRUSTED}" actual &&
156 + test_grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
157 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
158 + test_grep "${GPGSSH_KEY_NOT_TRUSTED}" actual &&
159 echo $commit OK || exit 1
160 done
161 )
@@ -164,34 +164,34 @@ test_expect_success GPGSSH 'verify and show signatures' '
164 test_expect_success GPGSSH 'verify-commit exits failure on untrusted signature' '
165 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
166 test_must_fail git verify-commit eighth-signed-alt 2>actual &&
167 - grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
168 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
169 - grep "${GPGSSH_KEY_NOT_TRUSTED}" actual
167 + test_grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
168 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
169 + test_grep "${GPGSSH_KEY_NOT_TRUSTED}" actual
170 '
171
172 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'verify-commit exits failure on expired signature key' '
173 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
174 test_must_fail git verify-commit expired-signed 2>actual &&
175 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
175 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
176 '
177
178 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'verify-commit exits failure on not yet valid signature key' '
179 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
180 test_must_fail git verify-commit notyetvalid-signed 2>actual &&
181 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
181 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
182 '
183
184 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'verify-commit succeeds with commit date and key validity matching' '
185 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
186 git verify-commit timeboxedvalid-signed 2>actual &&
187 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
188 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual
187 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
188 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual
189 '
190
191 test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'verify-commit exits failure with commit date outside of key validity' '
192 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
193 test_must_fail git verify-commit timeboxedinvalid-signed 2>actual &&
194 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
194 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
195 '
196
197 test_expect_success GPGSSH 'verify-commit exits success with matching minTrustLevel' '
@@ -217,8 +217,8 @@ test_expect_success GPGSSH 'verify signatures with --raw' '
217 for commit in initial second merge fourth-signed fifth-signed sixth-signed seventh-signed
218 do
219 git verify-commit --raw $commit 2>actual &&
220 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
221 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
220 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
221 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
222 echo $commit OK || exit 1
223 done
224 ) &&
@@ -226,8 +226,8 @@ test_expect_success GPGSSH 'verify signatures with --raw' '
226 for commit in merge^2 fourth-unsigned sixth-unsigned seventh-unsigned
227 do
228 test_must_fail git verify-commit --raw $commit 2>actual &&
229 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
230 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
229 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
230 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
231 echo $commit OK || exit 1
232 done
233 ) &&
@@ -235,8 +235,8 @@ test_expect_success GPGSSH 'verify signatures with --raw' '
235 for commit in eighth-signed-alt
236 do
237 test_must_fail git verify-commit --raw $commit 2>actual &&
238 - grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
239 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual &&
238 + test_grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual &&
239 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual &&
240 echo $commit OK || exit 1
241 done
242 )
@@ -244,7 +244,7 @@ test_expect_success GPGSSH 'verify signatures with --raw' '
244
245 test_expect_success GPGSSH 'proper header is used for hash algorithm' '
246 git cat-file commit fourth-signed >output &&
247 - grep "^$(test_oid header) -----BEGIN SSH SIGNATURE-----" output
247 + test_grep "^$(test_oid header) -----BEGIN SSH SIGNATURE-----" output
248 '
249
250 test_expect_success GPGSSH 'show signed commit with signature' '
@@ -268,9 +268,9 @@ test_expect_success GPGSSH 'detect fudged signature' '
268 git hash-object -w -t commit forged1 >forged1.commit &&
269 test_must_fail git verify-commit $(cat forged1.commit) &&
270 git show --pretty=short --show-signature $(cat forged1.commit) >actual1 &&
271 - grep "${GPGSSH_BAD_SIGNATURE}" actual1 &&
272 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual1 &&
273 - ! grep "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual1
271 + test_grep "${GPGSSH_BAD_SIGNATURE}" actual1 &&
272 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual1 &&
273 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_UNTRUSTED}" actual1
274 '
275
276 test_expect_success GPGSSH 'detect fudged signature with NUL' '
@@ -281,8 +281,8 @@ test_expect_success GPGSSH 'detect fudged signature with NUL' '
281 git hash-object --literally -w -t commit forged2 >forged2.commit &&
282 test_must_fail git verify-commit $(cat forged2.commit) &&
283 git show --pretty=short --show-signature $(cat forged2.commit) >actual2 &&
284 - grep "${GPGSSH_BAD_SIGNATURE}" actual2 &&
285 - ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual2
284 + test_grep "${GPGSSH_BAD_SIGNATURE}" actual2 &&
285 + test_grep ! "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual2
286 '
287
288 test_expect_success GPGSSH 'amending already signed commit' '
@@ -293,8 +293,8 @@ test_expect_success GPGSSH 'amending already signed commit' '
293 git commit --amend -S --no-edit &&
294 git verify-commit HEAD &&
295 git show -s --show-signature HEAD >actual &&
296 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
297 - ! grep "${GPGSSH_BAD_SIGNATURE}" actual
296 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
297 + test_grep ! "${GPGSSH_BAD_SIGNATURE}" actual
298 '
299
300 test_expect_success GPGSSH 'show good signature with custom format' '
@@ -386,7 +386,7 @@ test_expect_success GPGSSH 'log.showsignature behaves like --show-signature' '
386 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
387 test_config log.showsignature true &&
388 git show initial >actual &&
389 - grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
389 + test_grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
390 '
391
392 test_expect_success GPGSSH 'check config gpg.format values' '
@@ -410,8 +410,8 @@ test_expect_failure GPGSSH 'detect fudged commit with double signature (TODO)' '
410 git hash-object -w -t commit double-commit >double-commit.commit &&
411 test_must_fail git verify-commit $(cat double-commit.commit) &&
412 git show --pretty=short --show-signature $(cat double-commit.commit) >double-actual &&
413 - grep "BAD signature from" double-actual &&
414 - grep "Good signature from" double-actual
413 + test_grep "BAD signature from" double-actual &&
414 + test_grep "Good signature from" double-actual
415 '
416
417 test_expect_failure GPGSSH 'show double signature with custom format (TODO)' '
@@ -463,8 +463,8 @@ test_expect_failure GPGSSH 'verify-commit verifies multiply signed commits (TODO
463 head=$(git hash-object -t commit -w commit) &&
464 git reset --hard $head &&
465 git verify-commit $head 2>actual &&
466 - grep "Good signature from" actual &&
467 - ! grep "BAD signature from" actual
466 + test_grep "Good signature from" actual &&
467 + test_grep ! "BAD signature from" actual
468 '
469
470 test_done
t/t7600-merge.sh
+5 -5
@@ -342,8 +342,8 @@ test_expect_success 'merge --squash --autostash conflict does not attempt to app
342 >unrelated &&
343 git add unrelated &&
344 test_must_fail git merge --squash c7 --autostash >out 2>err &&
345 - ! grep "Applying autostash resulted in conflicts." err &&
346 - grep "When finished, apply stashed changes with \`git stash pop\`" out
345 + test_grep ! "Applying autostash resulted in conflicts." err &&
346 + test_grep "When finished, apply stashed changes with \`git stash pop\`" out
347 '
348
349 test_expect_success 'merge c3 with c7 with commit.cleanup = scissors' '
@@ -990,7 +990,7 @@ test_expect_success 'merge --no-ff --edit' '
990 EDITOR=./editor git merge --no-ff --edit c1 &&
991 verify_parents $c0 $c1 &&
992 git cat-file commit HEAD >raw &&
993 - grep "work done on the side branch" raw &&
993 + test_grep "work done on the side branch" raw &&
994 sed "1,/^$/d" >actual raw &&
995 test_cmp expected actual
996 '
@@ -1157,13 +1157,13 @@ test_expect_success 'merge suggests matching remote refname' '
1157 git pack-refs --all --prune &&
1158
1159 test_must_fail git merge not-local 2>stderr &&
1160 - grep origin/not-local stderr
1160 + test_grep origin/not-local stderr
1161 '
1162
1163 test_expect_success 'suggested names are not ambiguous' '
1164 git update-ref refs/heads/origin/not-local HEAD &&
1165 test_must_fail git merge not-local 2>stderr &&
1166 - grep remotes/origin/not-local stderr
1166 + test_grep remotes/origin/not-local stderr
1167 '
1168
1169 test_done
t/t7603-merge-reduce-heads.sh
+10 -10
@@ -59,11 +59,11 @@ test_expect_success 'merge c1 with c2, c3, c4, c5' '
59 test_path_is_file c4.c &&
60 test_path_is_file c5.c &&
61 git show --format=%s -s >actual &&
62 - ! grep c1 actual &&
63 - grep c2 actual &&
64 - grep c3 actual &&
65 - ! grep c4 actual &&
66 - grep c5 actual
62 + test_grep ! c1 actual &&
63 + test_grep c2 actual &&
64 + test_grep c3 actual &&
65 + test_grep ! c4 actual &&
66 + test_grep c5 actual
67 '
68
69 test_expect_success 'pull c2, c3, c4, c5 into c1' '
@@ -82,11 +82,11 @@ test_expect_success 'pull c2, c3, c4, c5 into c1' '
82 test_path_is_file c4.c &&
83 test_path_is_file c5.c &&
84 git show --format=%s -s >actual &&
85 - ! grep c1 actual &&
86 - grep c2 actual &&
87 - grep c3 actual &&
88 - ! grep c4 actual &&
89 - grep c5 actual
85 + test_grep ! c1 actual &&
86 + test_grep c2 actual &&
87 + test_grep c3 actual &&
88 + test_grep ! c4 actual &&
89 + test_grep c5 actual
90 '
91
92 test_expect_success 'setup' '
t/t7606-merge-custom.sh
+1 -1
@@ -60,7 +60,7 @@ test_expect_success 'merge c2 with a custom strategy' '
60 test_cmp second-parent.expected second-parent &&
61 test_cmp tree.expected tree &&
62 test -f c0.c &&
63 - grep c1c1 c1.c &&
63 + test_grep c1c1 c1.c &&
64 test -f c2.c
65 '
66
t/t7607-merge-state.sh
+2 -2
@@ -20,8 +20,8 @@ test_expect_success 'Ensure we restore original state if no merge strategy handl
20 # just hit conflicts, it completely fails and says that it cannot
21 # handle this type of merge.
22 test_expect_code 2 git merge branch2 branch3 >output 2>&1 &&
23 - grep "fatal: merge program failed" output &&
24 - grep "Should not be doing an octopus" output &&
23 + test_grep "fatal: merge program failed" output &&
24 + test_grep "Should not be doing an octopus" output &&
25
26 # Make sure we did not leave stray changes around when no appropriate
27 # merge strategy was found
t/t7610-mergetool.sh
+9 -9
@@ -738,7 +738,7 @@ test_expect_success 'filenames seen by tools start with ./' '
738 test_config mergetool.myecho.trustExitCode true &&
739 test_must_fail git merge main &&
740 git mergetool --no-prompt --tool myecho -- both >actual &&
741 - grep ^\./both_LOCAL_ actual
741 + test_grep ^\./both_LOCAL_ actual
742 '
743
744 test_lazy_prereq MKTEMP '
@@ -755,8 +755,8 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT
755 test_config mergetool.myecho.trustExitCode true &&
756 test_must_fail git merge main &&
757 git mergetool --no-prompt --tool myecho -- both >actual &&
758 - ! grep ^\./both_LOCAL_ actual &&
759 - grep /both_LOCAL_ actual
758 + test_grep ! ^\./both_LOCAL_ actual &&
759 + test_grep /both_LOCAL_ actual
760 '
761
762 test_expect_success 'diff.orderFile configuration is honored' '
@@ -816,12 +816,12 @@ test_expect_success 'mergetool -Oorder-file is honored' '
816 test_expect_success 'mergetool --tool-help shows recognized tools' '
817 # Check a few known tools are correctly shown
818 git mergetool --tool-help >mergetools &&
819 - grep vimdiff mergetools &&
820 - grep vimdiff3 mergetools &&
821 - grep gvimdiff2 mergetools &&
822 - grep araxis mergetools &&
823 - grep xxdiff mergetools &&
824 - grep meld mergetools
819 + test_grep vimdiff mergetools &&
820 + test_grep vimdiff3 mergetools &&
821 + test_grep gvimdiff2 mergetools &&
822 + test_grep araxis mergetools &&
823 + test_grep xxdiff mergetools &&
824 + test_grep meld mergetools
825 '
826
827 test_expect_success 'mergetool hideResolved' '
t/t7700-repack.sh
+7 -7
@@ -177,7 +177,7 @@ test_expect_success 'packed unreachable obs in alternate ODB are not loosened' '
177 rm -f .git/objects/pack/* &&
178 mv pack-* .git/objects/pack/ &&
179 git verify-pack -v -- .git/objects/pack/*.idx >packlist &&
180 - ! grep "^$coid " packlist &&
180 + test_grep ! "^$coid " packlist &&
181 echo >.git/objects/info/alternates &&
182 test_must_fail git show $coid
183 '
@@ -194,7 +194,7 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar
194 rm -f .git/objects/pack/* &&
195 mv pack-* .git/objects/pack/ &&
196 git verify-pack -v -- .git/objects/pack/*.idx >packlist &&
197 - ! grep "^$coid " packlist &&
197 + test_grep ! "^$coid " packlist &&
198 echo >.git/objects/info/alternates &&
199 test_must_fail git show $coid
200 '
@@ -226,8 +226,8 @@ test_expect_success 'repack --keep-pack' '
226 test_line_count = 4 old-counts &&
227 git repack -a -d --keep-pack $P1 --keep-pack $P4 &&
228 ls .git/objects/pack/*.pack >new-counts &&
229 - grep -q $P1 new-counts &&
230 - grep -q $P4 new-counts &&
229 + test_grep -q $P1 new-counts &&
230 + test_grep -q $P4 new-counts &&
231 test_line_count = 3 new-counts &&
232 git fsck &&
233
@@ -276,7 +276,7 @@ test_expect_success 'repacking fails when missing .pack actually means missing o
276
277 test_must_fail git fsck &&
278 test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git repack --cruft -d 2>err &&
279 - grep "bad object" err &&
279 + test_grep "bad object" err &&
280
281 # Before failing, the repack did not modify the
282 # pack directory.
@@ -460,8 +460,8 @@ test_expect_success '--filter works with --pack-kept-objects and .keep packs' '
460
461 # Object bar is in both the old .keep pack and the new
462 # pack that contained the filtered out objects
463 - grep "$bar_pack" bar_pack_1 &&
464 - grep "$foo_pack_1" bar_pack_1 &&
463 + test_grep "$bar_pack" bar_pack_1 &&
464 + test_grep "$foo_pack_1" bar_pack_1 &&
465 test "$foo_pack_1" != "$head_pack_1"
466 )
467 '
t/t7703-repack-geometric.sh
+2 -2
@@ -112,7 +112,7 @@ test_expect_success '--geometric with small-pack rollup' '
112 find $objdir/pack -name "*.pack" | sort >after &&
113 test_line_count = 3 after &&
114 comm -3 small before | tr -d "\t" >large &&
115 - grep -qFf large after
115 + test_grep -qFf large after
116 )
117 '
118
@@ -210,7 +210,7 @@ test_expect_success '--geometric ignores --keep-pack packs' '
210
211 # Packs should not have changed (only one non-kept pack, no
212 # loose objects), but $midx should now exist.
213 - grep "Nothing new to pack" out &&
213 + test_grep "Nothing new to pack" out &&
214 test_path_is_file $midx &&
215
216 test_cmp packs.before packs.after &&
t/t7704-repack-cruft.sh
+6 -6
@@ -166,9 +166,9 @@ test_expect_success '--max-cruft-size creates new packs when too large' '
166 test-tool pack-mtimes $(basename "$cruft_foo") >foo.objects &&
167 test-tool pack-mtimes $(basename "$cruft_bar") >bar.objects &&
168
169 - grep "^$foo" foo.objects &&
169 + test_grep "^$foo" foo.objects &&
170 test_line_count = 1 foo.objects &&
171 - grep "^$bar" bar.objects &&
171 + test_grep "^$bar" bar.objects &&
172 test_line_count = 1 bar.objects
173 )
174 '
@@ -188,8 +188,8 @@ test_expect_success '--max-cruft-size combines existing packs when not too large
188 cruft=$(ls $packdir/pack-*.mtimes) &&
189 test-tool pack-mtimes $(basename "$cruft") >cruft.objects &&
190
191 - grep "^$foo" cruft.objects &&
192 - grep "^$bar" cruft.objects &&
191 + test_grep "^$foo" cruft.objects &&
192 + test_grep "^$bar" cruft.objects &&
193 test_line_count = 2 cruft.objects
194 )
195 '
@@ -693,7 +693,7 @@ test_expect_success 'cruft repack respects repack.cruftWindow' '
693 git -c pack.window=1 -c repack.cruftWindow=2 repack \
694 --cruft --window=3 &&
695
696 - grep "pack-objects.*--window=2.*--cruft" event.trace
696 + test_grep "pack-objects.*--window=2.*--cruft" event.trace
697 )
698 '
699
@@ -708,7 +708,7 @@ test_expect_success 'cruft repack respects --window by default' '
708 GIT_TRACE2_EVENT=$(pwd)/event.trace \
709 git -c pack.window=2 repack --cruft --window=3 &&
710
711 - grep "pack-objects.*--window=3.*--cruft" event.trace
711 + test_grep "pack-objects.*--window=3.*--cruft" event.trace
712 )
713 '
714
t/t7800-difftool.sh
+13 -13
@@ -431,32 +431,32 @@ test_expect_success 'setup with 2 files different' '
431 test_expect_success 'say no to the first file' '
432 (echo n && echo) >input &&
433 git difftool -x cat branch <input >output &&
434 - grep m2 output &&
435 - grep br2 output &&
436 - ! grep main output &&
437 - ! grep branch output
434 + test_grep m2 output &&
435 + test_grep br2 output &&
436 + test_grep ! main output &&
437 + test_grep ! branch output
438 '
439
440 test_expect_success 'say no to the second file' '
441 (echo && echo n) >input &&
442 git difftool -x cat branch <input >output &&
443 - grep main output &&
444 - grep branch output &&
445 - ! grep m2 output &&
446 - ! grep br2 output
443 + test_grep main output &&
444 + test_grep branch output &&
445 + test_grep ! m2 output &&
446 + test_grep ! br2 output
447 '
448
449 test_expect_success 'ending prompt input with EOF' '
450 git difftool -x cat branch </dev/null >output &&
451 - ! grep main output &&
452 - ! grep branch output &&
453 - ! grep m2 output &&
454 - ! grep br2 output
451 + test_grep ! main output &&
452 + test_grep ! branch output &&
453 + test_grep ! m2 output &&
454 + test_grep ! br2 output
455 '
456
457 test_expect_success 'difftool --tool-help' '
458 git difftool --tool-help >output &&
459 - grep tool output
459 + test_grep tool output
460 '
461
462 test_expect_success 'setup change in subdirectory' '
t/t7810-grep.sh
+11 -11
@@ -1100,19 +1100,19 @@ test_expect_success 'grep -W with userdiff' '
1100 '
1101
1102 test_expect_success ' includes preceding comment' '
1103 - grep "# Say hello" function-context-userdiff-actual
1103 + test_grep "# Say hello" function-context-userdiff-actual
1104 '
1105
1106 test_expect_success ' includes function line' '
1107 - grep "=function hello" function-context-userdiff-actual
1107 + test_grep "=function hello" function-context-userdiff-actual
1108 '
1109
1110 test_expect_success ' includes matching line' '
1111 - grep ": echo" function-context-userdiff-actual
1111 + test_grep ": echo" function-context-userdiff-actual
1112 '
1113
1114 test_expect_success ' includes last line of the function' '
1115 - grep "} # hello" function-context-userdiff-actual
1115 + test_grep "} # hello" function-context-userdiff-actual
1116 '
1117
1118 for threads in $(test_seq 0 10)
@@ -1136,16 +1136,16 @@ test_expect_success !PTHREADS,!FAIL_PREREQS \
1136 git grep --threads=2 Hello hello_world 2>err &&
1137 grep ^warning: err >warnings &&
1138 test_line_count = 1 warnings &&
1139 - grep -F "no threads support, ignoring --threads" err &&
1139 + test_grep -F "no threads support, ignoring --threads" err &&
1140 git -c grep.threads=2 grep Hello hello_world 2>err &&
1141 grep ^warning: err >warnings &&
1142 test_line_count = 1 warnings &&
1143 - grep -F "no threads support, ignoring grep.threads" err &&
1143 + test_grep -F "no threads support, ignoring grep.threads" err &&
1144 git -c grep.threads=2 grep --threads=4 Hello hello_world 2>err &&
1145 grep ^warning: err >warnings &&
1146 test_line_count = 2 warnings &&
1147 - grep -F "no threads support, ignoring --threads" err &&
1148 - grep -F "no threads support, ignoring grep.threads" err &&
1147 + test_grep -F "no threads support, ignoring --threads" err &&
1148 + test_grep -F "no threads support, ignoring grep.threads" err &&
1149 git -c grep.threads=0 grep --threads=0 Hello hello_world 2>err &&
1150 test_line_count = 0 err
1151 '
@@ -1266,21 +1266,21 @@ test_expect_success 'no repository with path outside $cwd' '
1266 export GIT_CEILING_DIRECTORIES &&
1267 cd non/git &&
1268 test_expect_code 128 git grep --no-index search .. 2>error &&
1269 - grep "is outside the directory tree" error
1269 + test_grep "is outside the directory tree" error
1270 ) &&
1271 (
1272 GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
1273 export GIT_CEILING_DIRECTORIES &&
1274 cd non/git &&
1275 test_expect_code 128 git grep --no-index search ../tig 2>error &&
1276 - grep "is outside the directory tree" error
1276 + test_grep "is outside the directory tree" error
1277 ) &&
1278 (
1279 GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
1280 export GIT_CEILING_DIRECTORIES &&
1281 cd non/git &&
1282 test_expect_code 128 git grep --no-index search ../non 2>error &&
1283 - grep "no such path in the working tree" error
1283 + test_grep "no such path in the working tree" error
1284 )
1285 '
1286
t/t7814-grep-recurse-submodules.sh
+1 -1
@@ -590,7 +590,7 @@ test_expect_success 'grep partially-cloned submodule' '
590 --recurse-submodules HEAD^ >actual &&
591 test_cmp expect actual &&
592 # Verify that we actually fetched data from the promisor remote:
593 - grep \"category\":\"promisor\",\"key\":\"fetch_count\",\"value\":\"1\" trace2.log
593 + test_grep \"category\":\"promisor\",\"key\":\"fetch_count\",\"value\":\"1\" trace2.log
594 )
595 '
596
t/t7900-maintenance.sh
+17 -17
@@ -305,7 +305,7 @@ test_expect_success 'prefetch multiple remotes' '
305 test_cmp_rev refs/remotes/remote2/two refs/prefetch/remotes/remote2/two &&
306
307 git log --oneline --decorate --all >log &&
308 - ! grep "prefetch" log &&
308 + test_grep ! "prefetch" log &&
309
310 test_when_finished git config --unset remote.remote1.skipFetchAll &&
311 git config remote.remote1.skipFetchAll true &&
@@ -395,15 +395,15 @@ test_expect_success 'maintenance.loose-objects.batchSize' '
395
396 GIT_PROGRESS_DELAY=0 \
397 git -C loose-batch maintenance run --no-quiet --task=loose-objects 2>err &&
398 - grep "Enumerating objects: 50, done." err &&
398 + test_grep "Enumerating objects: 50, done." err &&
399
400 GIT_PROGRESS_DELAY=0 \
401 git -C loose-batch maintenance run --no-quiet --task=loose-objects 2>err &&
402 - grep "Enumerating objects: 50, done." err &&
402 + test_grep "Enumerating objects: 50, done." err &&
403
404 GIT_PROGRESS_DELAY=0 \
405 git -C loose-batch maintenance run --no-quiet --task=loose-objects 2>err &&
406 - grep "Enumerating objects: 2, done." err &&
406 + test_grep "Enumerating objects: 2, done." err &&
407
408 GIT_PROGRESS_DELAY=0 \
409 git -C loose-batch maintenance run --no-quiet --task=loose-objects 2>err &&
@@ -1067,7 +1067,7 @@ test_expect_success 'register and unregister' '
1067 test_when_finished git config --global --unset-all maintenance.repo &&
1068
1069 test_must_fail git maintenance unregister 2>err &&
1070 - grep "is not registered" err &&
1070 + test_grep "is not registered" err &&
1071 git maintenance unregister --force &&
1072
1073 git config --global --add maintenance.repo /existing1 &&
@@ -1101,11 +1101,11 @@ test_expect_success 'register and unregister' '
1101 test_cmp before actual &&
1102
1103 test_must_fail git maintenance unregister 2>err &&
1104 - grep "is not registered" err &&
1104 + test_grep "is not registered" err &&
1105 git maintenance unregister --force &&
1106
1107 test_must_fail git maintenance unregister --config-file ./other 2>err &&
1108 - grep "is not registered" err &&
1108 + test_grep "is not registered" err &&
1109 git maintenance unregister --config-file ./other --force
1110 '
1111
@@ -1194,9 +1194,9 @@ test_expect_success 'start from empty cron table' '
1194 # start registers the repo
1195 git config --get --global --fixed-value maintenance.repo "$(pwd)" &&
1196
1197 - grep "for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=daily" cron.txt &&
1198 - grep "for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=hourly" cron.txt &&
1199 - grep "for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=weekly" cron.txt
1197 + test_grep "for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=daily" cron.txt &&
1198 + test_grep "for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=hourly" cron.txt &&
1199 + test_grep "for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=weekly" cron.txt
1200 '
1201
1202 test_expect_success 'stop from existing schedule' '
@@ -1213,7 +1213,7 @@ test_expect_success 'stop from existing schedule' '
1213 test_expect_success 'start preserves existing schedule' '
1214 echo "Important information!" >cron.txt &&
1215 GIT_TEST_MAINT_SCHEDULER="crontab:test-tool crontab cron.txt" git maintenance start --scheduler=crontab &&
1216 - grep "Important information!" cron.txt
1216 + test_grep "Important information!" cron.txt
1217 '
1218
1219 test_expect_success 'magic markers are correct' '
@@ -1228,8 +1228,8 @@ test_expect_success 'magic markers are correct' '
1228 test_expect_success 'stop preserves surrounding schedule' '
1229 echo "Crucial information!" >>cron.txt &&
1230 GIT_TEST_MAINT_SCHEDULER="crontab:test-tool crontab cron.txt" git maintenance stop &&
1231 - grep "Important information!" cron.txt &&
1232 - grep "Crucial information!" cron.txt
1231 + test_grep "Important information!" cron.txt &&
1232 + test_grep "Crucial information!" cron.txt
1233 '
1234
1235 test_expect_success 'start and stop macOS maintenance' '
@@ -1259,7 +1259,7 @@ test_expect_success 'start and stop macOS maintenance' '
1259 do
1260 PLIST="$pfx/Library/LaunchAgents/org.git-scm.git.$frequency.plist" &&
1261 test_xmllint "$PLIST" &&
1262 - grep schedule=$frequency "$PLIST" &&
1262 + test_grep schedule=$frequency "$PLIST" &&
1263 echo "bootout gui/[UID] $PLIST" >>expect &&
1264 echo "bootstrap gui/[UID] $PLIST" >>expect || return 1
1265 done &&
@@ -1316,7 +1316,7 @@ test_expect_success 'start and stop Windows maintenance' '
1316
1317 for frequency in hourly daily weekly
1318 do
1319 - grep "/create /tn Git Maintenance ($frequency) /f /xml" args &&
1319 + test_grep "/create /tn Git Maintenance ($frequency) /f /xml" args &&
1320 file=$(ls .git/schedule_${frequency}*.xml) &&
1321 test_xmllint "$file" || return 1
1322 done &&
@@ -1355,8 +1355,8 @@ test_expect_success 'start and stop Linux/systemd maintenance' '
1355 test_systemd_analyze_verify "systemd/user/git-maintenance@daily.service" &&
1356 test_systemd_analyze_verify "systemd/user/git-maintenance@weekly.service" &&
1357
1358 - grep "core.askPass=true" "systemd/user/git-maintenance@.service" &&
1359 - grep "credential.interactive=false" "systemd/user/git-maintenance@.service" &&
1358 + test_grep "core.askPass=true" "systemd/user/git-maintenance@.service" &&
1359 + test_grep "credential.interactive=false" "systemd/user/git-maintenance@.service" &&
1360
1361 printf -- "--user enable --now git-maintenance@%s.timer\n" hourly daily weekly >expect &&
1362 test_cmp expect args &&
t/t8008-blame-formats.sh
+1 -1
@@ -103,7 +103,7 @@ test_expect_success '--porcelain detects first non-blank line as subject' '
103 "committer C <c@d.e> 123456789 +0000" |
104 git hash-object -w -t commit --stdin) &&
105 git blame --porcelain $commit -- single-file >output &&
106 - grep "^summary oneline$" output
106 + test_grep "^summary oneline$" output
107 )
108 '
109
t/t8010-cat-file-filters.sh
+1 -1
@@ -49,7 +49,7 @@ test_expect_success '--path=<path> complains without --textconv/--filters' '
49 sha1=$(git rev-parse -q --verify HEAD:world.txt) &&
50 test_must_fail git cat-file --path=hello.txt blob $sha1 >actual 2>err &&
51 test_must_be_empty actual &&
52 - grep "path.*needs.*filters" err
52 + test_grep "path.*needs.*filters" err
53 '
54
55 test_expect_success '--textconv/--filters complain without path' '
t/t8012-blame-colors.sh
+1 -1
@@ -66,7 +66,7 @@ test_expect_success 'blame color by age: new code is different' '
66
67 grep "<CYAN>" <actual >colored &&
68 test_line_count = 1 colored &&
69 - grep qfunc colored
69 + test_grep qfunc colored
70 '
71
72 test_done
t/t9001-send-email.sh
+95 -95
@@ -348,9 +348,9 @@ test_expect_success $PREREQ 'Prompting works' '
348 --smtp-server="$(pwd)/fake.sendmail" \
349 $patches \
350 2>errors &&
351 - grep "^From: A U Thor <author@example.com>\$" msgtxt1 &&
352 - grep "^To: to@example.com\$" msgtxt1 &&
353 - grep "^In-Reply-To: <my-message-id@example.com>" msgtxt1
351 + test_grep "^From: A U Thor <author@example.com>\$" msgtxt1 &&
352 + test_grep "^To: to@example.com\$" msgtxt1 &&
353 + test_grep "^In-Reply-To: <my-message-id@example.com>" msgtxt1
354 '
355
356 test_expect_success $PREREQ,AUTOIDENT 'implicit ident is allowed' '
@@ -403,7 +403,7 @@ test_expect_success $PREREQ 'tocmd works' '
403 --smtp-server="$(pwd)/fake.sendmail" \
404 tocmd.patch \
405 &&
406 - grep "^To: tocmd@example.com" msgtxt1
406 + test_grep "^To: tocmd@example.com" msgtxt1
407 '
408
409 test_expect_success $PREREQ 'cccmd works' '
@@ -417,7 +417,7 @@ test_expect_success $PREREQ 'cccmd works' '
417 --smtp-server="$(pwd)/fake.sendmail" \
418 cccmd.patch \
419 &&
420 - grep "^ cccmd@example.com" msgtxt1
420 + test_grep "^ cccmd@example.com" msgtxt1
421 '
422
423 test_expect_success $PREREQ 'headercmd works' '
@@ -431,7 +431,7 @@ test_expect_success $PREREQ 'headercmd works' '
431 --smtp-server="$(pwd)/fake.sendmail" \
432 headercmd.patch \
433 &&
434 - grep "^X-Debbugs-CC: dummy@example.com" msgtxt1
434 + test_grep "^X-Debbugs-CC: dummy@example.com" msgtxt1
435 '
436
437 test_expect_success $PREREQ '--no-header-cmd works' '
@@ -446,7 +446,7 @@ test_expect_success $PREREQ '--no-header-cmd works' '
446 --smtp-server="$(pwd)/fake.sendmail" \
447 headercmd.patch \
448 &&
449 - ! grep "^X-Debbugs-CC: dummy@example.com" msgtxt1
449 + test_grep ! "^X-Debbugs-CC: dummy@example.com" msgtxt1
450 '
451
452 test_expect_success $PREREQ 'multiline fields are correctly unfolded' '
@@ -464,7 +464,7 @@ FoldedField: This is a tale
464 --header-cmd=./headercmd-multiline \
465 --smtp-server="$(pwd)/fake.sendmail" \
466 headercmd.patch &&
467 - grep "^FoldedField: This is a tale best told using multiple lines.$" msgtxt1
467 + test_grep "^FoldedField: This is a tale best told using multiple lines.$" msgtxt1
468 '
469
470 # Blank lines in the middle of the output of a command are invalid.
@@ -521,7 +521,7 @@ test_expect_success $PREREQ 'Author From: in message body' '
521 --smtp-server="$(pwd)/fake.sendmail" \
522 $patches &&
523 sed "1,/^\$/d" <msgtxt1 >msgbody1 &&
524 - grep "From: A <author@example.com>" msgbody1
524 + test_grep "From: A <author@example.com>" msgbody1
525 '
526
527 test_expect_success $PREREQ 'Author From: not in message body' '
@@ -532,7 +532,7 @@ test_expect_success $PREREQ 'Author From: not in message body' '
532 --smtp-server="$(pwd)/fake.sendmail" \
533 $patches &&
534 sed "1,/^\$/d" <msgtxt1 >msgbody1 &&
535 - ! grep "From: A <author@example.com>" msgbody1
535 + test_grep ! "From: A <author@example.com>" msgbody1
536 '
537
538 test_expect_success $PREREQ 'allow long lines with --no-validate' '
@@ -553,7 +553,7 @@ test_expect_success $PREREQ 'short lines with auto encoding are 8bit' '
553 --smtp-server="$(pwd)/fake.sendmail" \
554 --transfer-encoding=auto \
555 $patches &&
556 - grep "Content-Transfer-Encoding: 8bit" msgtxt1
556 + test_grep "Content-Transfer-Encoding: 8bit" msgtxt1
557 '
558
559 test_expect_success $PREREQ 'long lines with auto encoding are quoted-printable' '
@@ -565,7 +565,7 @@ test_expect_success $PREREQ 'long lines with auto encoding are quoted-printable'
565 --transfer-encoding=auto \
566 --no-validate \
567 longline.patch &&
568 - grep "Content-Transfer-Encoding: quoted-printable" msgtxt1
568 + test_grep "Content-Transfer-Encoding: quoted-printable" msgtxt1
569 '
570
571 test_expect_success $PREREQ 'carriage returns with auto encoding are quoted-printable' '
@@ -579,7 +579,7 @@ test_expect_success $PREREQ 'carriage returns with auto encoding are quoted-prin
579 --transfer-encoding=auto \
580 --no-validate \
581 cr.patch &&
582 - grep "Content-Transfer-Encoding: quoted-printable" msgtxt1
582 + test_grep "Content-Transfer-Encoding: quoted-printable" msgtxt1
583 '
584
585 for enc in auto quoted-printable base64
@@ -705,7 +705,7 @@ do
705 --smtp-server="$(pwd)/fake.sendmail" \
706 --transfer-encoding=$enc \
707 $patches &&
708 - grep "Content-Transfer-Encoding: $enc" msgtxt1
708 + test_grep "Content-Transfer-Encoding: $enc" msgtxt1
709 '
710 done
711
@@ -718,7 +718,7 @@ test_expect_success $PREREQ 'Invalid In-Reply-To' '
718 --smtp-server="$(pwd)/fake.sendmail" \
719 $patches \
720 2>errors &&
721 - ! grep "^In-Reply-To: < *>" msgtxt1
721 + test_grep ! "^In-Reply-To: < *>" msgtxt1
722 '
723
724 test_expect_success $PREREQ 'Valid In-Reply-To when prompting' '
@@ -729,7 +729,7 @@ test_expect_success $PREREQ 'Valid In-Reply-To when prompting' '
729 ) | GIT_SEND_EMAIL_NOTTY=1 git send-email \
730 --smtp-server="$(pwd)/fake.sendmail" \
731 $patches 2>errors &&
732 - ! grep "^In-Reply-To: < *>" msgtxt1
732 + test_grep ! "^In-Reply-To: < *>" msgtxt1
733 '
734
735 test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
@@ -792,8 +792,8 @@ test_expect_success $PREREQ 'fake editor dies with error' '
792 --to=nobody@example.com \
793 --smtp-server="$(pwd)/fake.sendmail" \
794 $patches 2>err &&
795 - grep "I am about to error" err &&
796 - grep "the editor exited uncleanly, aborting everything" err
795 + test_grep "I am about to error" err &&
796 + test_grep "the editor exited uncleanly, aborting everything" err
797 '
798
799 test_expect_success $PREREQ 'setup fake editor' '
@@ -814,11 +814,11 @@ test_expect_success $PREREQ '--compose works' '
814 '
815
816 test_expect_success $PREREQ 'first message is compose text' '
817 - grep "^fake edit" msgtxt1
817 + test_grep "^fake edit" msgtxt1
818 '
819
820 test_expect_success $PREREQ 'second message is patch' '
821 - grep "Subject:.*Second" msgtxt2
821 + test_grep "Subject:.*Second" msgtxt2
822 '
823
824 test_expect_success $PREREQ 'setup expect' "
@@ -1237,8 +1237,8 @@ test_expect_success $PREREQ '--compose adds MIME for utf8 body' '
1237 --to=nobody@example.com \
1238 --smtp-server="$(pwd)/fake.sendmail" \
1239 $patches &&
1240 - grep "^utf8 body" msgtxt1 &&
1241 - grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
1240 + test_grep "^utf8 body" msgtxt1 &&
1241 + test_grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
1242 '
1243
1244 test_expect_success $PREREQ '--compose respects user mime type' '
@@ -1260,9 +1260,9 @@ test_expect_success $PREREQ '--compose respects user mime type' '
1260 --to=nobody@example.com \
1261 --smtp-server="$(pwd)/fake.sendmail" \
1262 $patches &&
1263 - grep "^utf8 body" msgtxt1 &&
1264 - grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1 &&
1265 - ! grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
1263 + test_grep "^utf8 body" msgtxt1 &&
1264 + test_grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1 &&
1265 + test_grep ! "^Content-Type: text/plain; charset=UTF-8" msgtxt1
1266 '
1267
1268 test_expect_success $PREREQ '--compose adds MIME for utf8 subject' '
@@ -1274,8 +1274,8 @@ test_expect_success $PREREQ '--compose adds MIME for utf8 subject' '
1274 --to=nobody@example.com \
1275 --smtp-server="$(pwd)/fake.sendmail" \
1276 $patches &&
1277 - grep "^fake edit" msgtxt1 &&
1278 - grep "^Subject: =?UTF-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
1277 + test_grep "^fake edit" msgtxt1 &&
1278 + test_grep "^Subject: =?UTF-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
1279 '
1280
1281 test_expect_success $PREREQ 'utf8 author is correctly passed on' '
@@ -1288,7 +1288,7 @@ test_expect_success $PREREQ 'utf8 author is correctly passed on' '
1288 --to=nobody@example.com \
1289 --smtp-server="$(pwd)/fake.sendmail" \
1290 funny_name.patch &&
1291 - grep "^From: Füñný Nâmé <odd_?=mail@example.com>" msgtxt1
1291 + test_grep "^From: Füñný Nâmé <odd_?=mail@example.com>" msgtxt1
1292 '
1293
1294 test_expect_success $PREREQ 'utf8 sender is not duplicated' '
@@ -1361,8 +1361,8 @@ test_expect_success $PREREQ 'sendemail.composeencoding works' '
1361 --to=nobody@example.com \
1362 --smtp-server="$(pwd)/fake.sendmail" \
1363 $patches &&
1364 - grep "^utf8 body" msgtxt1 &&
1365 - grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
1364 + test_grep "^utf8 body" msgtxt1 &&
1365 + test_grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
1366 '
1367
1368 test_expect_success $PREREQ '--compose-encoding works' '
@@ -1378,8 +1378,8 @@ test_expect_success $PREREQ '--compose-encoding works' '
1378 --to=nobody@example.com \
1379 --smtp-server="$(pwd)/fake.sendmail" \
1380 $patches &&
1381 - grep "^utf8 body" msgtxt1 &&
1382 - grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
1381 + test_grep "^utf8 body" msgtxt1 &&
1382 + test_grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
1383 '
1384
1385 test_expect_success $PREREQ '--compose-encoding overrides sendemail.composeencoding' '
@@ -1396,8 +1396,8 @@ test_expect_success $PREREQ '--compose-encoding overrides sendemail.composeencod
1396 --to=nobody@example.com \
1397 --smtp-server="$(pwd)/fake.sendmail" \
1398 $patches &&
1399 - grep "^utf8 body" msgtxt1 &&
1400 - grep "^Content-Type: text/plain; charset=iso-8859-2" msgtxt1
1399 + test_grep "^utf8 body" msgtxt1 &&
1400 + test_grep "^Content-Type: text/plain; charset=iso-8859-2" msgtxt1
1401 '
1402
1403 test_expect_success $PREREQ '--compose-encoding adds correct MIME for subject' '
@@ -1410,8 +1410,8 @@ test_expect_success $PREREQ '--compose-encoding adds correct MIME for subject' '
1410 --to=nobody@example.com \
1411 --smtp-server="$(pwd)/fake.sendmail" \
1412 $patches &&
1413 - grep "^fake edit" msgtxt1 &&
1414 - grep "^Subject: =?iso-8859-2?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
1413 + test_grep "^fake edit" msgtxt1 &&
1414 + test_grep "^Subject: =?iso-8859-2?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
1415 '
1416
1417 test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '
@@ -1419,7 +1419,7 @@ test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '
1419 git add main &&
1420 git commit -m"add main" &&
1421 test_must_fail git send-email --dry-run main 2>errors &&
1422 - grep disambiguate errors
1422 + test_grep disambiguate errors
1423 '
1424
1425 test_expect_success $PREREQ 'feed two files' '
@@ -1443,7 +1443,7 @@ test_expect_success $PREREQ 'in-reply-to but no threading' '
1443 --in-reply-to="<in-reply-id@example.com>" \
1444 --no-thread \
1445 $patches >out &&
1446 - grep "In-Reply-To: <in-reply-id@example.com>" out
1446 + test_grep "In-Reply-To: <in-reply-id@example.com>" out
1447 '
1448
1449 test_expect_success $PREREQ 'no in-reply-to and no threading' '
@@ -1453,7 +1453,7 @@ test_expect_success $PREREQ 'no in-reply-to and no threading' '
1453 --to=nobody@example.com \
1454 --no-thread \
1455 $patches >stdout &&
1456 - ! grep "In-Reply-To: " stdout
1456 + test_grep ! "In-Reply-To: " stdout
1457 '
1458
1459 test_expect_success $PREREQ 'threading but no chain-reply-to' '
@@ -1464,7 +1464,7 @@ test_expect_success $PREREQ 'threading but no chain-reply-to' '
1464 --thread \
1465 --no-chain-reply-to \
1466 $patches $patches >stdout &&
1467 - grep "In-Reply-To: " stdout
1467 + test_grep "In-Reply-To: " stdout
1468 '
1469
1470 test_expect_success $PREREQ 'override in-reply-to if no threading' '
@@ -1475,7 +1475,7 @@ test_expect_success $PREREQ 'override in-reply-to if no threading' '
1475 --no-thread \
1476 --in-reply-to="override" \
1477 $threaded_patches >stdout &&
1478 - grep "In-Reply-To: <override>" stdout
1478 + test_grep "In-Reply-To: <override>" stdout
1479 '
1480
1481 test_expect_success $PREREQ 'sendemail.to works' '
@@ -1484,7 +1484,7 @@ test_expect_success $PREREQ 'sendemail.to works' '
1484 --dry-run \
1485 --from="Example <nobody@example.com>" \
1486 $patches >stdout &&
1487 - grep "To: Somebody <somebody@ex.com>" stdout
1487 + test_grep "To: Somebody <somebody@ex.com>" stdout
1488 '
1489
1490 test_expect_success $PREREQ 'setup sendemail.identity' '
@@ -1498,7 +1498,7 @@ test_expect_success $PREREQ 'sendemail.identity: reads the correct identity conf
1498 --dry-run \
1499 --from="nobody@example.com" \
1500 $patches >stdout &&
1501 - grep "To: cloud@example.com" stdout
1501 + test_grep "To: cloud@example.com" stdout
1502 '
1503
1504 test_expect_success $PREREQ 'sendemail.identity: identity overrides sendemail.identity' '
@@ -1507,7 +1507,7 @@ test_expect_success $PREREQ 'sendemail.identity: identity overrides sendemail.id
1507 --dry-run \
1508 --from="nobody@example.com" \
1509 $patches >stdout &&
1510 - grep "To: isp@example.com" stdout
1510 + test_grep "To: isp@example.com" stdout
1511 '
1512
1513 test_expect_success $PREREQ 'sendemail.identity: --no-identity clears previous identity' '
@@ -1516,7 +1516,7 @@ test_expect_success $PREREQ 'sendemail.identity: --no-identity clears previous i
1516 --dry-run \
1517 --from="nobody@example.com" \
1518 $patches >stdout &&
1519 - grep "To: default@example.com" stdout
1519 + test_grep "To: default@example.com" stdout
1520 '
1521
1522 test_expect_success $PREREQ 'sendemail.identity: bool identity variable existence overrides' '
@@ -1527,8 +1527,8 @@ test_expect_success $PREREQ 'sendemail.identity: bool identity variable existenc
1527 --dry-run \
1528 --from="nobody@example.com" \
1529 $patches >stdout &&
1530 - grep "To: cloud@example.com" stdout &&
1531 - ! grep "X-Mailer" stdout
1530 + test_grep "To: cloud@example.com" stdout &&
1531 + test_grep ! "X-Mailer" stdout
1532 '
1533
1534 test_expect_success $PREREQ 'sendemail.identity: bool variable fallback' '
@@ -1538,8 +1538,8 @@ test_expect_success $PREREQ 'sendemail.identity: bool variable fallback' '
1538 --dry-run \
1539 --from="nobody@example.com" \
1540 $patches >stdout &&
1541 - grep "To: cloud@example.com" stdout &&
1542 - ! grep "X-Mailer" stdout
1541 + test_grep "To: cloud@example.com" stdout &&
1542 + test_grep ! "X-Mailer" stdout
1543 '
1544
1545 test_expect_success $PREREQ 'sendemail.identity: bool variable without a value' '
@@ -1548,8 +1548,8 @@ test_expect_success $PREREQ 'sendemail.identity: bool variable without a value'
1548 --dry-run \
1549 --from="nobody@example.com" \
1550 $patches >stdout &&
1551 - grep "To: default@example.com" stdout &&
1552 - grep "X-Mailer" stdout
1551 + test_grep "To: default@example.com" stdout &&
1552 + test_grep "X-Mailer" stdout
1553 '
1554
1555 test_expect_success $PREREQ '--no-to overrides sendemail.to' '
@@ -1559,8 +1559,8 @@ test_expect_success $PREREQ '--no-to overrides sendemail.to' '
1559 --no-to \
1560 --to=nobody@example.com \
1561 $patches >stdout &&
1562 - grep "To: nobody@example.com" stdout &&
1563 - ! grep "To: Somebody <somebody@ex.com>" stdout
1562 + test_grep "To: nobody@example.com" stdout &&
1563 + test_grep ! "To: Somebody <somebody@ex.com>" stdout
1564 '
1565
1566 test_expect_success $PREREQ 'sendemail.cc works' '
@@ -1570,7 +1570,7 @@ test_expect_success $PREREQ 'sendemail.cc works' '
1570 --from="Example <nobody@example.com>" \
1571 --to=nobody@example.com \
1572 $patches >stdout &&
1573 - grep "Cc: Somebody <somebody@ex.com>" stdout
1573 + test_grep "Cc: Somebody <somebody@ex.com>" stdout
1574 '
1575
1576 test_expect_success $PREREQ '--no-cc overrides sendemail.cc' '
@@ -1581,8 +1581,8 @@ test_expect_success $PREREQ '--no-cc overrides sendemail.cc' '
1581 --cc=bodies@example.com \
1582 --to=nobody@example.com \
1583 $patches >stdout &&
1584 - grep "Cc: bodies@example.com" stdout &&
1585 - ! grep "Cc: Somebody <somebody@ex.com>" stdout
1584 + test_grep "Cc: bodies@example.com" stdout &&
1585 + test_grep ! "Cc: Somebody <somebody@ex.com>" stdout
1586 '
1587
1588 test_expect_success $PREREQ 'sendemail.bcc works' '
@@ -1593,7 +1593,7 @@ test_expect_success $PREREQ 'sendemail.bcc works' '
1593 --to=nobody@example.com \
1594 --smtp-server relay.example.com \
1595 $patches >stdout &&
1596 - grep "RCPT TO:<other@ex.com>" stdout
1596 + test_grep "RCPT TO:<other@ex.com>" stdout
1597 '
1598
1599 test_expect_success $PREREQ '--no-bcc overrides sendemail.bcc' '
@@ -1605,8 +1605,8 @@ test_expect_success $PREREQ '--no-bcc overrides sendemail.bcc' '
1605 --to=nobody@example.com \
1606 --smtp-server relay.example.com \
1607 $patches >stdout &&
1608 - grep "RCPT TO:<bodies@example.com>" stdout &&
1609 - ! grep "RCPT TO:<other@ex.com>" stdout
1608 + test_grep "RCPT TO:<bodies@example.com>" stdout &&
1609 + test_grep ! "RCPT TO:<other@ex.com>" stdout
1610 '
1611
1612 test_expect_success $PREREQ 'patches To headers are used by default' '
@@ -1617,7 +1617,7 @@ test_expect_success $PREREQ 'patches To headers are used by default' '
1617 --from="Example <nobody@example.com>" \
1618 --smtp-server relay.example.com \
1619 $patch >stdout &&
1620 - grep "RCPT TO:<bodies@example.com>" stdout
1620 + test_grep "RCPT TO:<bodies@example.com>" stdout
1621 '
1622
1623 test_expect_success $PREREQ 'patches To headers are appended to' '
@@ -1629,8 +1629,8 @@ test_expect_success $PREREQ 'patches To headers are appended to' '
1629 --to=nobody@example.com \
1630 --smtp-server relay.example.com \
1631 $patch >stdout &&
1632 - grep "RCPT TO:<bodies@example.com>" stdout &&
1633 - grep "RCPT TO:<nobody@example.com>" stdout
1632 + test_grep "RCPT TO:<bodies@example.com>" stdout &&
1633 + test_grep "RCPT TO:<nobody@example.com>" stdout
1634 '
1635
1636 test_expect_success $PREREQ 'To headers from files reset each patch' '
@@ -1691,9 +1691,9 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
1691 git send-email --from=author@example.com --to=nobody@example.com \
1692 --smtp-server="$(pwd)/fake.sendmail" \
1693 email-using-8bit >stdout &&
1694 - grep "do not declare a Content-Transfer-Encoding" stdout &&
1695 - grep email-using-8bit stdout &&
1696 - grep "Declare which 8bit encoding to use" stdout &&
1694 + test_grep "do not declare a Content-Transfer-Encoding" stdout &&
1695 + test_grep email-using-8bit stdout &&
1696 + test_grep "Declare which 8bit encoding to use" stdout &&
1697 grep -E "Content|MIME" msgtxt1 >actual &&
1698 test_cmp content-type-decl actual
1699 '
@@ -1790,7 +1790,7 @@ test_expect_success $PREREQ '--transfer-encoding overrides sendemail.transferEnc
1790 --smtp-server="$(pwd)/fake.sendmail" \
1791 email-using-8bit \
1792 2>errors >out &&
1793 - grep "cannot send message as 7bit" errors &&
1793 + test_grep "cannot send message as 7bit" errors &&
1794 test -z "$(ls msgtxt*)"
1795 '
1796
@@ -1801,7 +1801,7 @@ test_expect_success $PREREQ 'sendemail.transferEncoding via config' '
1801 --smtp-server="$(pwd)/fake.sendmail" \
1802 email-using-8bit \
1803 2>errors >out &&
1804 - grep "cannot send message as 7bit" errors &&
1804 + test_grep "cannot send message as 7bit" errors &&
1805 test -z "$(ls msgtxt*)"
1806 '
1807
@@ -1812,7 +1812,7 @@ test_expect_success $PREREQ 'sendemail.transferEncoding via cli' '
1812 --smtp-server="$(pwd)/fake.sendmail" \
1813 email-using-8bit \
1814 2>errors >out &&
1815 - grep "cannot send message as 7bit" errors &&
1815 + test_grep "cannot send message as 7bit" errors &&
1816 test -z "$(ls msgtxt*)"
1817 '
1818
@@ -1939,7 +1939,7 @@ test_expect_success $PREREQ 'refusing to send cover letter template' '
1939 outdir/0000-*.patch \
1940 outdir/0001-*.patch \
1941 2>errors >out &&
1942 - grep "SUBJECT HERE" errors &&
1942 + test_grep "SUBJECT HERE" errors &&
1943 test -z "$(ls msgtxt*)"
1944 '
1945
@@ -1956,7 +1956,7 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '
1956 outdir/0000-*.patch \
1957 outdir/0001-*.patch \
1958 2>errors >out &&
1959 - ! grep "SUBJECT HERE" errors &&
1959 + test_grep ! "SUBJECT HERE" errors &&
1960 test -n "$(ls msgtxt*)"
1961 '
1962
@@ -2016,8 +2016,8 @@ test_expect_success $PREREQ 'escaped quotes in sendemail.aliasfiletype=mutt' '
2016 --smtp-server="$(pwd)/fake.sendmail" \
2017 outdir/0001-*.patch \
2018 2>errors >out &&
2019 - grep "^!somebody@example\.org!$" commandline1 &&
2020 - grep -F "To: \"Dot U. Sir\" <somebody@example.org>" out
2019 + test_grep "^!somebody@example\.org!$" commandline1 &&
2020 + test_grep -F "To: \"Dot U. Sir\" <somebody@example.org>" out
2021 '
2022
2023 test_expect_success $PREREQ 'sendemail.aliasfiletype=mailrc' '
@@ -2031,7 +2031,7 @@ test_expect_success $PREREQ 'sendemail.aliasfiletype=mailrc' '
2031 --smtp-server="$(pwd)/fake.sendmail" \
2032 outdir/0001-*.patch \
2033 2>errors >out &&
2034 - grep "^!somebody@example\.org!$" commandline1
2034 + test_grep "^!somebody@example\.org!$" commandline1
2035 '
2036
2037 test_expect_success $PREREQ 'sendemail.aliasesfile=~/.mailrc' '
@@ -2045,7 +2045,7 @@ test_expect_success $PREREQ 'sendemail.aliasesfile=~/.mailrc' '
2045 --smtp-server="$(pwd)/fake.sendmail" \
2046 outdir/0001-*.patch \
2047 2>errors >out &&
2048 - grep "^!someone@example\.org!$" commandline1
2048 + test_grep "^!someone@example\.org!$" commandline1
2049 '
2050
2051 test_dump_aliases () {
@@ -2264,7 +2264,7 @@ test_sendmail_aliases () {
2264 2>errors >out &&
2265 for i in $expect
2266 do
2267 - grep "^!$i!$" commandline1 || return 1
2267 + test_grep "^!$i!$" commandline1 || return 1
2268 done
2269 '
2270 }
@@ -2328,7 +2328,7 @@ test_expect_success $PREREQ 'alias support in To header' '
2328 --smtp-server="$(pwd)/fake.sendmail" \
2329 aliased.patch \
2330 2>errors >out &&
2331 - grep "^!someone@example\.org!$" commandline1
2331 + test_grep "^!someone@example\.org!$" commandline1
2332 '
2333
2334 test_expect_success $PREREQ 'alias support in Cc header' '
@@ -2342,7 +2342,7 @@ test_expect_success $PREREQ 'alias support in Cc header' '
2342 --smtp-server="$(pwd)/fake.sendmail" \
2343 aliased.patch \
2344 2>errors >out &&
2345 - grep "^!someone@example\.org!$" commandline1
2345 + test_grep "^!someone@example\.org!$" commandline1
2346 '
2347
2348 test_expect_success $PREREQ 'tocmd works with aliases' '
@@ -2358,7 +2358,7 @@ test_expect_success $PREREQ 'tocmd works with aliases' '
2358 --smtp-server="$(pwd)/fake.sendmail" \
2359 tocmd.patch \
2360 2>errors >out &&
2361 - grep "^!someone@example\.org!$" commandline1
2361 + test_grep "^!someone@example\.org!$" commandline1
2362 '
2363
2364 test_expect_success $PREREQ 'cccmd works with aliases' '
@@ -2374,7 +2374,7 @@ test_expect_success $PREREQ 'cccmd works with aliases' '
2374 --smtp-server="$(pwd)/fake.sendmail" \
2375 cccmd.patch \
2376 2>errors >out &&
2377 - grep "^!someone@example\.org!$" commandline1
2377 + test_grep "^!someone@example\.org!$" commandline1
2378 '
2379
2380 do_xmailer_test () {
@@ -2511,7 +2511,7 @@ test_expect_success $PREREQ 'mailmap support with --to' '
2511 --mailmap \
2512 a.patch \
2513 2>errors >out &&
2514 - grep "^!someone@example\.com!$" commandline1
2514 + test_grep "^!someone@example\.com!$" commandline1
2515 '
2516
2517 test_expect_success $PREREQ 'sendemail.mailmap configuration' '
@@ -2528,7 +2528,7 @@ test_expect_success $PREREQ 'sendemail.mailmap configuration' '
2528 --to=someone@example.org \
2529 a.patch \
2530 2>errors >out &&
2531 - grep "^!someone@example\.com!$" commandline1
2531 + test_grep "^!someone@example\.com!$" commandline1
2532 '
2533
2534 test_expect_success $PREREQ 'sendemail.mailmap.file configuration' '
@@ -2545,7 +2545,7 @@ test_expect_success $PREREQ 'sendemail.mailmap.file configuration' '
2545 --to=someone@example.org \
2546 a.patch \
2547 2>errors >out &&
2548 - grep "^!someone@example\.com!$" commandline1
2548 + test_grep "^!someone@example\.com!$" commandline1
2549 '
2550
2551 test_expect_success $PREREQ 'sendemail.mailmap identity overrides configuration' '
@@ -2564,7 +2564,7 @@ test_expect_success $PREREQ 'sendemail.mailmap identity overrides configuration'
2564 --to=someone@example.org \
2565 a.patch \
2566 2>errors >out &&
2567 - grep "^!someone@example\.com!$" commandline1
2567 + test_grep "^!someone@example\.com!$" commandline1
2568 '
2569
2570 test_expect_success $PREREQ '--no-mailmap overrides configuration' '
@@ -2584,7 +2584,7 @@ test_expect_success $PREREQ '--no-mailmap overrides configuration' '
2584 --no-mailmap \
2585 a.patch \
2586 2>errors >out &&
2587 - grep "^!someone@example\.org!$" commandline1
2587 + test_grep "^!someone@example\.org!$" commandline1
2588 '
2589
2590 test_expect_success $PREREQ 'mailmap support in To header' '
@@ -2600,7 +2600,7 @@ test_expect_success $PREREQ 'mailmap support in To header' '
2600 --mailmap \
2601 a.patch \
2602 2>errors >out &&
2603 - grep "^!someone@example\.com!$" commandline1
2603 + test_grep "^!someone@example\.com!$" commandline1
2604 '
2605
2606 test_expect_success $PREREQ 'mailmap support in Cc header' '
@@ -2616,7 +2616,7 @@ test_expect_success $PREREQ 'mailmap support in Cc header' '
2616 --mailmap \
2617 a.patch \
2618 2>errors >out &&
2619 - grep "^!someone@example\.com!$" commandline1
2619 + test_grep "^!someone@example\.com!$" commandline1
2620 '
2621
2622 test_expect_success $PREREQ 'test using command name with --sendmail-cmd' '
@@ -2676,9 +2676,9 @@ test_expect_success $PREREQ 'patch reply headers correct with --no-thread' '
2676 --to=nobody@example.com \
2677 --smtp-server="$(pwd)/fake.sendmail" \
2678 has-reply.patch no-reply.patch &&
2679 - grep "In-Reply-To: <replied.to@example.com>" msgtxt1 &&
2680 - grep "References: <replied.to@example.com>" msgtxt1 &&
2681 - ! grep replied.to@example.com msgtxt2
2679 + test_grep "In-Reply-To: <replied.to@example.com>" msgtxt1 &&
2680 + test_grep "References: <replied.to@example.com>" msgtxt1 &&
2681 + test_grep ! replied.to@example.com msgtxt2
2682 '
2683
2684 test_expect_success $PREREQ 'cmdline in-reply-to used with --no-thread' '
@@ -2689,10 +2689,10 @@ test_expect_success $PREREQ 'cmdline in-reply-to used with --no-thread' '
2689 --to=nobody@example.com \
2690 --smtp-server="$(pwd)/fake.sendmail" \
2691 has-reply.patch no-reply.patch &&
2692 - grep "In-Reply-To: <cmdline.reply@example.com>" msgtxt1 &&
2693 - grep "References: <cmdline.reply@example.com>" msgtxt1 &&
2694 - grep "In-Reply-To: <cmdline.reply@example.com>" msgtxt2 &&
2695 - grep "References: <cmdline.reply@example.com>" msgtxt2
2692 + test_grep "In-Reply-To: <cmdline.reply@example.com>" msgtxt1 &&
2693 + test_grep "References: <cmdline.reply@example.com>" msgtxt1 &&
2694 + test_grep "In-Reply-To: <cmdline.reply@example.com>" msgtxt2 &&
2695 + test_grep "References: <cmdline.reply@example.com>" msgtxt2
2696 '
2697
2698 test_expect_success $PREREQ 'invoke hook' '
@@ -2775,7 +2775,7 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' '
2775 test_expect_success $PREREQ 'send-email relays -v 3 to format-patch' '
2776 test_when_finished "rm -f out" &&
2777 git send-email --dry-run -v 3 -1 >out &&
2778 - grep "PATCH v3" out
2778 + test_grep "PATCH v3" out
2779 '
2780
2781 test_expect_success $PREREQ 'test that sendmail config is rejected' '
@@ -2819,7 +2819,7 @@ test_expect_success $PREREQ '--compose handles lowercase headers' '
2819 --to=nobody@example.com \
2820 --smtp-server="$(pwd)/fake.sendmail" \
2821 HEAD^ &&
2822 - grep "From: edited-from@example.com" msgtxt1
2822 + test_grep "From: edited-from@example.com" msgtxt1
2823 '
2824
2825 test_expect_success $PREREQ '--compose handles to headers' '
t/t9003-help-autocorrect.sh
+3 -3
@@ -34,10 +34,10 @@ do
34 git config help.autocorrect $show &&
35
36 test_must_fail git lfg 2>actual &&
37 - grep "^ lgf" actual &&
37 + test_grep "^ lgf" actual &&
38
39 test_must_fail git distimdist 2>actual &&
40 - grep "^ distimdistim" actual
40 + test_grep "^ distimdistim" actual
41 '
42 done
43
@@ -60,7 +60,7 @@ test_expect_success 'autocorrect can be declined altogether' '
60 git config help.autocorrect never &&
61
62 test_must_fail git lfg 2>actual &&
63 - grep "is not a git command" actual &&
63 + test_grep "is not a git command" actual &&
64 test_line_count = 1 actual
65 '
66
t/t9106-git-svn-commit-diff-clobber.sh
+1 -1
@@ -94,7 +94,7 @@ test_expect_success 'multiple dcommit from git svn will not clobber svn' "
94
95 test_expect_success 'check that rebase really failed' '
96 git status >output &&
97 - grep currently.rebasing output
97 + test_grep currently.rebasing output
98 '
99
100 test_expect_success 'resolve, continue the rebase and dcommit' "
t/t9107-git-svn-migrate.sh
+15 -15
@@ -46,7 +46,7 @@ test_expect_success 'initialize old-style (v0) git svn layout' '
46 test_expect_success 'initialize a multi-repository repo' '
47 git svn init "$svnrepo" -T trunk -t tags -b branches &&
48 git config --get-all svn-remote.svn.fetch > fetch.out &&
49 - grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
49 + test_grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
50 test -n "$(git config --get svn-remote.svn.branches \
51 "^branches/\*:refs/remotes/origin/\*$")" &&
52 test -n "$(git config --get svn-remote.svn.tags \
@@ -63,13 +63,13 @@ test_expect_success 'initialize a multi-repository repo' '
63 $i:refs/remotes/origin/$i || return 1
64 done &&
65 git config --get-all svn-remote.svn.fetch > fetch.out &&
66 - grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
67 - grep "^branches/a:refs/remotes/origin/a$" fetch.out &&
68 - grep "^branches/b:refs/remotes/origin/b$" fetch.out &&
69 - grep "^tags/0\.1:refs/remotes/origin/tags/0\.1$" fetch.out &&
70 - grep "^tags/0\.2:refs/remotes/origin/tags/0\.2$" fetch.out &&
71 - grep "^tags/0\.3:refs/remotes/origin/tags/0\.3$" fetch.out &&
72 - grep "^:refs/remotes/git-svn" fetch.out
66 + test_grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
67 + test_grep "^branches/a:refs/remotes/origin/a$" fetch.out &&
68 + test_grep "^branches/b:refs/remotes/origin/b$" fetch.out &&
69 + test_grep "^tags/0\.1:refs/remotes/origin/tags/0\.1$" fetch.out &&
70 + test_grep "^tags/0\.2:refs/remotes/origin/tags/0\.2$" fetch.out &&
71 + test_grep "^tags/0\.3:refs/remotes/origin/tags/0\.3$" fetch.out &&
72 + test_grep "^:refs/remotes/git-svn" fetch.out
73 '
74
75 # refs should all be different, but the trees should all be the same:
@@ -109,13 +109,13 @@ test_expect_success 'migrate --minimize on old inited layout' '
109 git svn migrate --minimize &&
110 test -z "$(git config -l | grep "^svn-remote\.git-svn\.")" &&
111 git config --get-all svn-remote.svn.fetch > fetch.out &&
112 - grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
113 - grep "^branches/a:refs/remotes/origin/a$" fetch.out &&
114 - grep "^branches/b:refs/remotes/origin/b$" fetch.out &&
115 - grep "^tags/0\.1:refs/remotes/origin/tags/0\.1$" fetch.out &&
116 - grep "^tags/0\.2:refs/remotes/origin/tags/0\.2$" fetch.out &&
117 - grep "^tags/0\.3:refs/remotes/origin/tags/0\.3$" fetch.out &&
118 - grep "^:refs/remotes/git-svn" fetch.out
112 + test_grep "^trunk:refs/remotes/origin/trunk$" fetch.out &&
113 + test_grep "^branches/a:refs/remotes/origin/a$" fetch.out &&
114 + test_grep "^branches/b:refs/remotes/origin/b$" fetch.out &&
115 + test_grep "^tags/0\.1:refs/remotes/origin/tags/0\.1$" fetch.out &&
116 + test_grep "^tags/0\.2:refs/remotes/origin/tags/0\.2$" fetch.out &&
117 + test_grep "^tags/0\.3:refs/remotes/origin/tags/0\.3$" fetch.out &&
118 + test_grep "^:refs/remotes/git-svn" fetch.out
119 '
120
121 test_expect_success ".rev_db auto-converted to .rev_map.UUID" '
t/t9110-git-svn-use-svm-props.sh
+10 -10
@@ -22,36 +22,36 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89
22 bar_url=http://mayonaise/svnrepo/bar
23 test_expect_success 'verify metadata for /bar' "
24 git cat-file commit refs/remotes/bar >actual &&
25 - grep '^git-svn-id: $bar_url@12 $uuid$' actual &&
25 + test_grep '^git-svn-id: $bar_url@12 $uuid$' actual &&
26 git cat-file commit refs/remotes/bar~1 >actual &&
27 - grep '^git-svn-id: $bar_url@11 $uuid$' actual &&
27 + test_grep '^git-svn-id: $bar_url@11 $uuid$' actual &&
28 git cat-file commit refs/remotes/bar~2 >actual &&
29 - grep '^git-svn-id: $bar_url@10 $uuid$' actual &&
29 + test_grep '^git-svn-id: $bar_url@10 $uuid$' actual &&
30 git cat-file commit refs/remotes/bar~3 >actual &&
31 - grep '^git-svn-id: $bar_url@9 $uuid$' actual &&
31 + test_grep '^git-svn-id: $bar_url@9 $uuid$' actual &&
32 git cat-file commit refs/remotes/bar~4 >actual &&
33 - grep '^git-svn-id: $bar_url@6 $uuid$' actual &&
33 + test_grep '^git-svn-id: $bar_url@6 $uuid$' actual &&
34 git cat-file commit refs/remotes/bar~5 >actual &&
35 - grep '^git-svn-id: $bar_url@1 $uuid$' actual
35 + test_grep '^git-svn-id: $bar_url@1 $uuid$' actual
36 "
37
38 e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e
39 test_expect_success 'verify metadata for /dir/a/b/c/d/e' "
40 git cat-file commit refs/remotes/e >actual &&
41 - grep '^git-svn-id: $e_url@1 $uuid$' actual
41 + test_grep '^git-svn-id: $e_url@1 $uuid$' actual
42 "
43
44 dir_url=http://mayonaise/svnrepo/dir
45 test_expect_success 'verify metadata for /dir' "
46 git cat-file commit refs/remotes/dir >actual &&
47 - grep '^git-svn-id: $dir_url@2 $uuid$' actual &&
47 + test_grep '^git-svn-id: $dir_url@2 $uuid$' actual &&
48 git cat-file commit refs/remotes/dir~1 >actual &&
49 - grep '^git-svn-id: $dir_url@1 $uuid$' actual
49 + test_grep '^git-svn-id: $dir_url@1 $uuid$' actual
50 "
51
52 test_expect_success 'find commit based on SVN revision number' "
53 git svn find-rev r12 >actual &&
54 - grep $(git rev-parse HEAD) actual
54 + test_grep $(git rev-parse HEAD) actual
55 "
56
57 test_expect_success 'empty rebase' "
t/t9111-git-svn-use-svnsync-props.sh
+9 -9
@@ -21,31 +21,31 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89
21 bar_url=http://mayonaise/svnrepo/bar
22 test_expect_success 'verify metadata for /bar' "
23 git cat-file commit refs/remotes/bar >actual &&
24 - grep '^git-svn-id: $bar_url@12 $uuid$' actual &&
24 + test_grep '^git-svn-id: $bar_url@12 $uuid$' actual &&
25 git cat-file commit refs/remotes/bar~1 >actual &&
26 - grep '^git-svn-id: $bar_url@11 $uuid$' actual &&
26 + test_grep '^git-svn-id: $bar_url@11 $uuid$' actual &&
27 git cat-file commit refs/remotes/bar~2 >actual &&
28 - grep '^git-svn-id: $bar_url@10 $uuid$' actual &&
28 + test_grep '^git-svn-id: $bar_url@10 $uuid$' actual &&
29 git cat-file commit refs/remotes/bar~3 >actual &&
30 - grep '^git-svn-id: $bar_url@9 $uuid$' actual &&
30 + test_grep '^git-svn-id: $bar_url@9 $uuid$' actual &&
31 git cat-file commit refs/remotes/bar~4 >actual &&
32 - grep '^git-svn-id: $bar_url@6 $uuid$' actual &&
32 + test_grep '^git-svn-id: $bar_url@6 $uuid$' actual &&
33 git cat-file commit refs/remotes/bar~5 >actual &&
34 - grep '^git-svn-id: $bar_url@1 $uuid$' actual
34 + test_grep '^git-svn-id: $bar_url@1 $uuid$' actual
35 "
36
37 e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e
38 test_expect_success 'verify metadata for /dir/a/b/c/d/e' "
39 git cat-file commit refs/remotes/e >actual &&
40 - grep '^git-svn-id: $e_url@1 $uuid$' actual
40 + test_grep '^git-svn-id: $e_url@1 $uuid$' actual
41 "
42
43 dir_url=http://mayonaise/svnrepo/dir
44 test_expect_success 'verify metadata for /dir' "
45 git cat-file commit refs/remotes/dir >actual &&
46 - grep '^git-svn-id: $dir_url@2 $uuid$' actual &&
46 + test_grep '^git-svn-id: $dir_url@2 $uuid$' actual &&
47 git cat-file commit refs/remotes/dir~1 >actual &&
48 - grep '^git-svn-id: $dir_url@1 $uuid$' actual
48 + test_grep '^git-svn-id: $dir_url@1 $uuid$' actual
49 "
50
51 test_done
t/t9114-git-svn-dcommit-merge.sh
+3 -3
@@ -69,7 +69,7 @@ test_expect_success 'verify pre-merge ancestry' "
69 test x\$(git rev-parse --verify refs/heads/svn^2) = \
70 x\$(git rev-parse --verify refs/heads/merge) &&
71 git cat-file commit refs/heads/svn^ >actual &&
72 - grep '^friend$' actual
72 + test_grep '^friend$' actual
73 "
74
75 test_expect_success 'git svn dcommit merges' "
@@ -84,12 +84,12 @@ test_expect_success 'verify post-merge ancestry' "
84 test x\$(git rev-parse --verify refs/heads/svn^2) = \
85 x\$(git rev-parse --verify refs/heads/merge) &&
86 git cat-file commit refs/heads/svn^ >actual &&
87 - grep '^friend$' actual
87 + test_grep '^friend$' actual
88 "
89
90 test_expect_success 'verify merge commit message' "
91 git rev-list --pretty=raw -1 refs/heads/svn >actual &&
92 - grep \" Merge branch 'merge' into svn\" actual
92 + test_grep \" Merge branch 'merge' into svn\" actual
93 "
94
95 test_done
t/t9116-git-svn-log.sh
+4 -4
@@ -45,17 +45,17 @@ test_expect_success 'setup repository and import' '
45 test_expect_success 'run log' "
46 git reset --hard origin/a &&
47 git svn log -r2 origin/trunk >out &&
48 - grep ^r2 out &&
48 + test_grep ^r2 out &&
49 git svn log -r4 origin/trunk >out &&
50 - grep ^r4 out &&
50 + test_grep ^r4 out &&
51 git svn log -r3 >out &&
52 - grep ^r3 out
52 + test_grep ^r3 out
53 "
54
55 test_expect_success 'run log against a from trunk' "
56 git reset --hard origin/trunk &&
57 git svn log -r3 origin/a >out &&
58 - grep ^r3 out
58 + test_grep ^r3 out
59 "
60
61 printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4
t/t9117-git-svn-init-clone.sh
+6 -6
@@ -49,7 +49,7 @@ test_expect_success 'clone to target directory with --stdlayout' '
49 test_expect_success 'init without -s/-T/-b/-t does not warn' '
50 test ! -d trunk &&
51 git svn init "$svnrepo"/project/trunk trunk 2>warning &&
52 - ! grep -q prefix warning &&
52 + test_grep ! -q prefix warning &&
53 rm -rf trunk &&
54 rm -f warning
55 '
@@ -57,7 +57,7 @@ test_expect_success 'init without -s/-T/-b/-t does not warn' '
57 test_expect_success 'clone without -s/-T/-b/-t does not warn' '
58 test ! -d trunk &&
59 git svn clone "$svnrepo"/project/trunk 2>warning &&
60 - ! grep -q prefix warning &&
60 + test_grep ! -q prefix warning &&
61 rm -rf trunk &&
62 rm -f warning
63 '
@@ -80,7 +80,7 @@ EOF
80 test_expect_success 'init with -s/-T/-b/-t assumes --prefix=origin/' '
81 test ! -d project &&
82 git svn init -s "$svnrepo"/project project 2>warning &&
83 - ! grep -q prefix warning &&
83 + test_grep ! -q prefix warning &&
84 test_svn_configured_prefix "origin/" &&
85 rm -rf project &&
86 rm -f warning
@@ -89,7 +89,7 @@ test_expect_success 'init with -s/-T/-b/-t assumes --prefix=origin/' '
89 test_expect_success 'clone with -s/-T/-b/-t assumes --prefix=origin/' '
90 test ! -d project &&
91 git svn clone -s "$svnrepo"/project 2>warning &&
92 - ! grep -q prefix warning &&
92 + test_grep ! -q prefix warning &&
93 test_svn_configured_prefix "origin/" &&
94 rm -rf project &&
95 rm -f warning
@@ -98,7 +98,7 @@ test_expect_success 'clone with -s/-T/-b/-t assumes --prefix=origin/' '
98 test_expect_success 'init with -s/-T/-b/-t and --prefix "" still works' '
99 test ! -d project &&
100 git svn init -s "$svnrepo"/project project --prefix "" 2>warning &&
101 - ! grep -q prefix warning &&
101 + test_grep ! -q prefix warning &&
102 test_svn_configured_prefix "" &&
103 rm -rf project &&
104 rm -f warning
@@ -107,7 +107,7 @@ test_expect_success 'init with -s/-T/-b/-t and --prefix "" still works' '
107 test_expect_success 'clone with -s/-T/-b/-t and --prefix "" still works' '
108 test ! -d project &&
109 git svn clone -s "$svnrepo"/project --prefix "" 2>warning &&
110 - ! grep -q prefix warning &&
110 + test_grep ! -q prefix warning &&
111 test_svn_configured_prefix "" &&
112 rm -rf project &&
113 rm -f warning
t/t9119-git-svn-info.sh
+8 -8
@@ -333,27 +333,27 @@ test_expect_success 'info unknown-file' "
333 echo two > gitwc/unknown-file &&
334 (cd gitwc && test_must_fail git svn info unknown-file) \
335 2> actual.info-unknown-file &&
336 - grep unknown-file actual.info-unknown-file
336 + test_grep unknown-file actual.info-unknown-file
337 "
338
339 test_expect_success 'info --url unknown-file' '
340 echo two > gitwc/unknown-file &&
341 (cd gitwc && test_must_fail git svn info --url unknown-file) \
342 2> actual.info-url-unknown-file &&
343 - grep unknown-file actual.info-url-unknown-file
343 + test_grep unknown-file actual.info-url-unknown-file
344 '
345
346 test_expect_success 'info unknown-directory' "
347 mkdir gitwc/unknown-directory svnwc/unknown-directory &&
348 (cd gitwc && test_must_fail git svn info unknown-directory) \
349 2> actual.info-unknown-directory &&
350 - grep unknown-directory actual.info-unknown-directory
350 + test_grep unknown-directory actual.info-unknown-directory
351 "
352
353 test_expect_success 'info --url unknown-directory' '
354 (cd gitwc && test_must_fail git svn info --url unknown-directory) \
355 2> actual.info-url-unknown-directory &&
356 - grep unknown-directory actual.info-url-unknown-directory
356 + test_grep unknown-directory actual.info-url-unknown-directory
357 '
358
359 test_expect_success 'info unknown-symlink-file' "
@@ -363,13 +363,13 @@ test_expect_success 'info unknown-symlink-file' "
363 ) &&
364 (cd gitwc && test_must_fail git svn info unknown-symlink-file) \
365 2> actual.info-unknown-symlink-file &&
366 - grep unknown-symlink-file actual.info-unknown-symlink-file
366 + test_grep unknown-symlink-file actual.info-unknown-symlink-file
367 "
368
369 test_expect_success 'info --url unknown-symlink-file' '
370 (cd gitwc && test_must_fail git svn info --url unknown-symlink-file) \
371 2> actual.info-url-unknown-symlink-file &&
372 - grep unknown-symlink-file actual.info-url-unknown-symlink-file
372 + test_grep unknown-symlink-file actual.info-url-unknown-symlink-file
373 '
374
375 test_expect_success 'info unknown-symlink-directory' "
@@ -379,13 +379,13 @@ test_expect_success 'info unknown-symlink-directory' "
379 ) &&
380 (cd gitwc && test_must_fail git svn info unknown-symlink-directory) \
381 2> actual.info-unknown-symlink-directory &&
382 - grep unknown-symlink-directory actual.info-unknown-symlink-directory
382 + test_grep unknown-symlink-directory actual.info-unknown-symlink-directory
383 "
384
385 test_expect_success 'info --url unknown-symlink-directory' '
386 (cd gitwc && test_must_fail git svn info --url unknown-symlink-directory) \
387 2> actual.info-url-unknown-symlink-directory &&
388 - grep unknown-symlink-directory actual.info-url-unknown-symlink-directory
388 + test_grep unknown-symlink-directory actual.info-url-unknown-symlink-directory
389 '
390
391 test_done
t/t9122-git-svn-author.sh
+4 -4
@@ -57,15 +57,15 @@ test_expect_success 'interact with it via git svn' '
57 test "z$myself" = "z$unaffected" &&
58
59 # Make sure lack of --add-author-from did not add cruft
60 - ! grep "^ From: A U Thor " actual.2 &&
60 + test_grep ! "^ From: A U Thor " actual.2 &&
61
62 # Make sure --add-author-from added cruft
63 - grep "^ From: A U Thor " actual.3 &&
64 - grep "^ From: A U Thor " actual.4 &&
63 + test_grep "^ From: A U Thor " actual.3 &&
64 + test_grep "^ From: A U Thor " actual.4 &&
65
66 # Make sure --add-author-from with --use-log-author affected
67 # the authorship information
68 - grep "^Author: A U Thor " actual.4 &&
68 + test_grep "^Author: A U Thor " actual.4 &&
69
70 # Make sure there are no commit messages with excess blank lines
71 test $(grep "^ " actual.2 | wc -l) = 3 &&
t/t9130-git-svn-authors-file.sh
+4 -4
@@ -29,9 +29,9 @@ test_expect_success 'imported 2 revisions successfully' '
29 git rev-list refs/remotes/git-svn >actual &&
30 test_line_count = 2 actual &&
31 git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
32 - grep "^author BBBBBBB BBBBBBB <bb@example\.com> " actual &&
32 + test_grep "^author BBBBBBB BBBBBBB <bb@example\.com> " actual &&
33 git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
34 - grep "^author AAAAAAA AAAAAAA <aa@example\.com> " actual
34 + test_grep "^author AAAAAAA AAAAAAA <aa@example\.com> " actual
35 )
36 '
37
@@ -47,9 +47,9 @@ test_expect_success 'continues to import once authors have been added' '
47 git rev-list refs/remotes/git-svn >actual &&
48 test_line_count = 4 actual &&
49 git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
50 - grep "^author DDDDDDD DDDDDDD <dd@example\.com> " actual &&
50 + test_grep "^author DDDDDDD DDDDDDD <dd@example\.com> " actual &&
51 git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
52 - grep "^author CCCCCCC CCCCCCC <cc@example\.com> " actual
52 + test_grep "^author CCCCCCC CCCCCCC <cc@example\.com> " actual
53 )
54 '
55
t/t9138-git-svn-authors-prog.sh
+7 -7
@@ -48,15 +48,15 @@ test_expect_success 'authors-prog ran correctly' '
48 (
49 cd x &&
50 git rev-list -1 --pretty=raw refs/remotes/git-svn~1 >actual &&
51 - grep "^author ee-foo <ee-foo@example\.com> " actual &&
51 + test_grep "^author ee-foo <ee-foo@example\.com> " actual &&
52 git rev-list -1 --pretty=raw refs/remotes/git-svn~2 >actual &&
53 - grep "^author dd <dd@sub\.example\.com> " actual &&
53 + test_grep "^author dd <dd@sub\.example\.com> " actual &&
54 git rev-list -1 --pretty=raw refs/remotes/git-svn~3 >actual &&
55 - grep "^author cc <cc@sub\.example\.com> " actual &&
55 + test_grep "^author cc <cc@sub\.example\.com> " actual &&
56 git rev-list -1 --pretty=raw refs/remotes/git-svn~4 >actual &&
57 - grep "^author bb <bb@example\.com> " actual &&
57 + test_grep "^author bb <bb@example\.com> " actual &&
58 git rev-list -1 --pretty=raw refs/remotes/git-svn~5 >actual &&
59 - grep "^author aa <aa@example\.com> " actual
59 + test_grep "^author aa <aa@example\.com> " actual
60 )
61 '
62
@@ -64,7 +64,7 @@ test_expect_success 'authors-file overrode authors-prog' '
64 (
65 cd x &&
66 git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
67 - grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> " actual
67 + test_grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> " actual
68 )
69 '
70
@@ -99,7 +99,7 @@ test_expect_success 'authors-prog handled special characters in username' '
99 cd x &&
100 git svn --authors-prog=../svn-authors-prog fetch &&
101 git rev-list -1 --pretty=raw refs/remotes/git-svn >actual &&
102 - grep "^author xyz; touch evil <xyz; touch evil@example\.com> " actual &&
102 + test_grep "^author xyz; touch evil <xyz; touch evil@example\.com> " actual &&
103 ! test -f evil
104 )
105 '
t/t9140-git-svn-reset.sh
+2 -2
@@ -43,7 +43,7 @@ test_expect_success 'fetch fails on modified hidden file' '
43 git svn find-rev refs/remotes/git-svn > ../expect &&
44 test_must_fail git svn fetch 2> ../errors &&
45 git svn find-rev refs/remotes/git-svn > ../expect2 ) &&
46 - grep "not found in commit" errors &&
46 + test_grep "not found in commit" errors &&
47 test_cmp expect expect2
48 '
49
@@ -59,7 +59,7 @@ test_expect_success 'refetch succeeds not ignoring any files' '
59 ( cd g &&
60 git svn fetch &&
61 git svn rebase &&
62 - grep "mod hidden" hid/hid.txt
62 + test_grep "mod hidden" hid/hid.txt
63 )
64 '
65
t/t9153-git-svn-rewrite-uuid.sh
+2 -2
@@ -17,9 +17,9 @@ test_expect_success 'load svn repo' "
17
18 test_expect_success 'verify uuid' "
19 git cat-file commit refs/remotes/git-svn~0 >actual &&
20 - grep '^git-svn-id: .*@2 $uuid$' actual &&
20 + test_grep '^git-svn-id: .*@2 $uuid$' actual &&
21 git cat-file commit refs/remotes/git-svn~1 >actual &&
22 - grep '^git-svn-id: .*@1 $uuid$' actual
22 + test_grep '^git-svn-id: .*@1 $uuid$' actual
23 "
24
25 test_done
t/t9200-git-cvsexportcommit.sh
+1 -1
@@ -336,7 +336,7 @@ test_expect_success 'use the same checkout for Git and CVS' '
336 echo Hello >> " space" &&
337 git commit -m "Another change" " space" &&
338 git cvsexportcommit -W -p -u -c HEAD &&
339 - grep Hello " space" &&
339 + test_grep Hello " space" &&
340 git diff-files)
341
342 '
t/t9210-scalar.sh
+17 -17
@@ -21,13 +21,13 @@ test_expect_success 'scalar invoked on enlistment root' '
21 # Register
22 scalar register ${enlistment_root} &&
23 scalar list >out &&
24 - grep "$(pwd)/${enlistment_root}/src\$" out &&
24 + test_grep "$(pwd)/${enlistment_root}/src\$" out &&
25
26 # Delete (including enlistment root)
27 scalar delete $enlistment_root &&
28 test_path_is_missing $enlistment_root &&
29 scalar list >out &&
30 - ! grep "^$(pwd)/${enlistment_root}/src\$" out || return 1
30 + test_grep ! "^$(pwd)/${enlistment_root}/src\$" out || return 1
31 done
32 '
33
@@ -41,13 +41,13 @@ test_expect_success 'scalar invoked on enlistment src repo' '
41 # Register
42 scalar register ${enlistment_root}/src &&
43 scalar list >out &&
44 - grep "$(pwd)/${enlistment_root}/src\$" out &&
44 + test_grep "$(pwd)/${enlistment_root}/src\$" out &&
45
46 # Delete (will not include enlistment root)
47 scalar delete ${enlistment_root}/src &&
48 test_path_is_dir $enlistment_root &&
49 scalar list >out &&
50 - ! grep "^$(pwd)/${enlistment_root}/src\$" out || return 1
50 + test_grep ! "^$(pwd)/${enlistment_root}/src\$" out || return 1
51 done
52 '
53
@@ -61,13 +61,13 @@ test_expect_success 'scalar invoked when enlistment root and repo are the same'
61 # Register
62 scalar register ${enlistment_root} &&
63 scalar list >out &&
64 - grep "$(pwd)/${enlistment_root}\$" out &&
64 + test_grep "$(pwd)/${enlistment_root}\$" out &&
65
66 # Delete (will not include enlistment root)
67 scalar delete ${enlistment_root} &&
68 test_path_is_missing $enlistment_root &&
69 scalar list >out &&
70 - ! grep "^$(pwd)/${enlistment_root}\$" out &&
70 + test_grep ! "^$(pwd)/${enlistment_root}\$" out &&
71
72 # Make sure we did not accidentally delete the trash dir
73 test_path_is_dir "$TRASH_DIRECTORY" || return 1
@@ -81,7 +81,7 @@ test_expect_success 'scalar repo search respects GIT_CEILING_DIRECTORIES' '
81 mkdir -p test/src/deep &&
82 GIT_CEILING_DIRECTORIES="$(pwd)/test/src" &&
83 ! scalar register test/src/deep 2>err &&
84 - grep "not a git repository" err
84 + test_grep "not a git repository" err
85 '
86
87 test_expect_success 'scalar enlistments need a worktree' '
@@ -89,11 +89,11 @@ test_expect_success 'scalar enlistments need a worktree' '
89
90 git init --bare bare/src &&
91 ! scalar register bare/src 2>err &&
92 - grep "Scalar enlistments require a worktree" err &&
92 + test_grep "Scalar enlistments require a worktree" err &&
93
94 git init test/src &&
95 ! scalar register test/src/.git 2>err &&
96 - grep "Scalar enlistments require a worktree" err
96 + test_grep "Scalar enlistments require a worktree" err
97 '
98
99 test_expect_success FSMONITOR_DAEMON 'scalar register starts fsmon daemon' '
@@ -108,7 +108,7 @@ test_expect_success 'scalar register warns when background maintenance fails' '
108 git init register-repo &&
109 GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
110 scalar register register-repo 2>err &&
111 - grep "could not toggle maintenance" err
111 + test_grep "could not toggle maintenance" err
112 '
113
114 test_expect_success 'scalar unregister' '
@@ -117,13 +117,13 @@ test_expect_success 'scalar unregister' '
117 git config --get --global --fixed-value \
118 maintenance.repo "$(pwd)/vanish/src" &&
119 scalar list >scalar.repos &&
120 - grep -F "$(pwd)/vanish/src" scalar.repos &&
120 + test_grep -F "$(pwd)/vanish/src" scalar.repos &&
121 rm -rf vanish/src/.git &&
122 scalar unregister vanish &&
123 test_must_fail git config --get --global --fixed-value \
124 maintenance.repo "$(pwd)/vanish/src" &&
125 scalar list >scalar.repos &&
126 - ! grep -F "$(pwd)/vanish/src" scalar.repos &&
126 + test_grep ! -F "$(pwd)/vanish/src" scalar.repos &&
127
128 # scalar unregister should be idempotent
129 scalar unregister vanish
@@ -278,7 +278,7 @@ test_expect_success '`reconfigure -a` removes stale config entries' '
278 git init stale/src &&
279 scalar register stale &&
280 scalar list >scalar.repos &&
281 - grep stale scalar.repos &&
281 + test_grep stale scalar.repos &&
282
283 grep -v stale scalar.repos >expect &&
284
@@ -307,7 +307,7 @@ test_expect_success 'scalar supports -c/-C' '
307
308 test_expect_success '`scalar [...] <dir>` errors out when dir is missing' '
309 ! scalar run config cloned 2>err &&
310 - grep "cloned. does not exist" err
310 + test_grep "cloned. does not exist" err
311 '
312
313 SQ="'"
@@ -318,7 +318,7 @@ test_expect_success UNZIP 'scalar diagnose' '
318 echo "$(pwd)/.git/objects/" >>cloned/src/.git/objects/info/alternates &&
319 test_commit -C cloned/src loose &&
320 scalar diagnose cloned >out 2>err &&
321 - grep "Available space" out &&
321 + test_grep "Available space" out &&
322 sed -n "s/.*$SQ\\(.*\\.zip\\)$SQ.*/\\1/p" <err >zip_path &&
323 zip_path=$(cat zip_path) &&
324 test -n "$zip_path" &&
@@ -328,9 +328,9 @@ test_expect_success UNZIP 'scalar diagnose' '
328 "$GIT_UNZIP" -p "$zip_path" diagnostics.log >out &&
329 test_file_not_empty out &&
330 "$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
331 - grep "$(pwd)/.git/objects" out &&
331 + test_grep "$(pwd)/.git/objects" out &&
332 "$GIT_UNZIP" -p "$zip_path" objects-local.txt >out &&
333 - grep "^Total: [1-9]" out
333 + test_grep "^Total: [1-9]" out
334 '
335
336 test_done
t/t9211-scalar-clone.sh
+8 -8
@@ -86,7 +86,7 @@ test_expect_success 'fall back on full clone if partial unsupported' '
86 test_config -C to-clone uploadpack.allowanysha1inwant false &&
87
88 scalar clone "file://$(pwd)/to-clone" $enlistment 2>err &&
89 - grep "filtering not recognized by server, ignoring" err &&
89 + test_grep "filtering not recognized by server, ignoring" err &&
90
91 (
92 cd $enlistment/src &&
@@ -133,7 +133,7 @@ test_expect_success '--single-branch clones HEAD only' '
133 cd $enlistment/src &&
134 git for-each-ref refs/remotes/origin >out &&
135 test_line_count = 2 out &&
136 - grep "refs/remotes/origin/base" out
136 + test_grep "refs/remotes/origin/base" out
137 ) &&
138
139 cleanup_clone $enlistment
@@ -147,8 +147,8 @@ test_expect_success '--no-single-branch clones all branches' '
147 cd $enlistment/src &&
148 git for-each-ref refs/remotes/origin >out &&
149 test_line_count = 3 out &&
150 - grep "refs/remotes/origin/base" out &&
151 - grep "refs/remotes/origin/parallel" out
150 + test_grep "refs/remotes/origin/base" out &&
151 + test_grep "refs/remotes/origin/parallel" out
152 ) &&
153
154 cleanup_clone $enlistment
@@ -174,15 +174,15 @@ test_expect_success 'progress without tty' '
174 test_config -C to-clone uploadpack.allowanysha1inwant true &&
175
176 GIT_PROGRESS_DELAY=0 scalar clone "file://$(pwd)/to-clone" "$enlistment" 2>stderr &&
177 - ! grep "Enumerating objects" stderr &&
178 - ! grep "Updating files" stderr &&
177 + test_grep ! "Enumerating objects" stderr &&
178 + test_grep ! "Updating files" stderr &&
179 cleanup_clone $enlistment
180 '
181
182 test_expect_success 'scalar clone warns when background maintenance fails' '
183 GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
184 scalar clone "file://$(pwd)/to-clone" maint-fail 2>err &&
185 - grep "could not toggle maintenance" err
185 + test_grep "could not toggle maintenance" err
186 '
187
188 test_expect_success 'scalar clone --no-maintenance' '
@@ -190,7 +190,7 @@ test_expect_success 'scalar clone --no-maintenance' '
190 GIT_TRACE2_EVENT="$(pwd)/no-maint.event" \
191 GIT_TRACE2_EVENT_DEPTH=100 \
192 scalar clone --no-maintenance "file://$(pwd)/to-clone" no-maint 2>err &&
193 - ! grep "could not toggle maintenance" err &&
193 + test_grep ! "could not toggle maintenance" err &&
194 test_subcommand ! git maintenance unregister --force <no-maint.event
195 '
196
t/t9300-fast-import.sh
+5 -5
@@ -436,7 +436,7 @@ test_expect_success 'B: accept invalid timezone with raw-permissive' '
436 git init invalid-timezone &&
437 git -C invalid-timezone fast-import --date-format=raw-permissive <input &&
438 git -C invalid-timezone cat-file -p invalid-timezone >out &&
439 - grep "1234567890 [+]051800" out
439 + test_grep "1234567890 [+]051800" out
440 '
441
442 test_expect_success 'B: accept and fixup committer with no name' '
@@ -2326,7 +2326,7 @@ test_expect_success 'R: export-marks feature results in a marks file being creat
2326 EOF
2327
2328 git fast-import --allow-unsafe-features <input &&
2329 - grep :1 git.marks
2329 + test_grep :1 git.marks
2330 '
2331
2332 test_expect_success 'R: export-marks options can be overridden by commandline options' '
@@ -2340,7 +2340,7 @@ test_expect_success 'R: export-marks options can be overridden by commandline op
2340 EOF
2341 git fast-import --allow-unsafe-features \
2342 --export-marks=cmdline-sub/other.marks <input &&
2343 - grep :1 cmdline-sub/other.marks &&
2343 + test_grep :1 cmdline-sub/other.marks &&
2344 test_path_is_missing feature-sub
2345 '
2346
@@ -3816,9 +3816,9 @@ test_expect_success 'X: replace ref that becomes useless is removed' '
3816 sed -e s/othername/somename/ tmp >tmp2 &&
3817 git fast-import --force <tmp2 2>msgs &&
3818
3819 - grep "dropping.*since it would point to itself" msgs &&
3819 + test_grep "dropping.*since it would point to itself" msgs &&
3820 git show-ref >refs &&
3821 - ! grep refs/replace refs
3821 + test_grep ! refs/replace refs
3822 )
3823 '
3824
t/t9350-fast-export.sh
+27 -27
@@ -139,9 +139,9 @@ test_expect_success ICONV 'reencoding iso-8859-7' '
139 test $(($(test_oid hexsz) + 181)) -eq "$(git -C new cat-file -s i18n)" &&
140 # ...and for the expected translation of bytes.
141 git -C new cat-file commit i18n >actual &&
142 - grep $(printf "\317\200") actual &&
142 + test_grep $(printf "\317\200") actual &&
143 # Also make sure the commit does not have the "encoding" header
144 - ! grep ^encoding actual
144 + test_grep ! ^encoding actual
145 '
146
147 test_expect_success 'aborting on iso-8859-7' '
@@ -170,9 +170,9 @@ test_expect_success 'preserving iso-8859-7' '
170 test $(($(test_oid hexsz) + 200)) -eq "$(git -C new cat-file -s i18n-no-recoding)" &&
171 # ...as well as the expected byte.
172 git -C new cat-file commit i18n-no-recoding >actual &&
173 - grep $(printf "\360") actual &&
173 + test_grep $(printf "\360") actual &&
174 # Also make sure the commit has the "encoding" header
175 - grep ^encoding actual
175 + test_grep ^encoding actual
176 '
177
178 test_expect_success 'encoding preserved if reencoding fails' '
@@ -186,13 +186,13 @@ test_expect_success 'encoding preserved if reencoding fails' '
186 git -C new cat-file commit i18n-invalid >actual &&
187
188 # Make sure the commit still has the encoding header
189 - grep ^encoding actual &&
189 + test_grep ^encoding actual &&
190 # Verify that the commit has the expected size; i.e.
191 # that no bytes were re-encoded to a different encoding.
192 test $(($(test_oid hexsz) + 212)) -eq "$(git -C new cat-file -s i18n-invalid)" &&
193 # ...and check for the original special bytes
194 - grep $(printf "\360") actual &&
195 - grep $(printf "\377") actual
194 + test_grep $(printf "\360") actual &&
195 + test_grep $(printf "\377") actual
196 '
197
198 test_expect_success 'import/export-marks' '
@@ -244,14 +244,14 @@ test_expect_success 'signed-tags=abort' '
244 test_expect_success 'signed-tags=verbatim' '
245
246 git fast-export --signed-tags=verbatim sign-your-name > output &&
247 - grep PGP output
247 + test_grep PGP output
248
249 '
250
251 test_expect_success 'signed-tags=warn-verbatim' '
252
253 git fast-export --signed-tags=warn-verbatim sign-your-name >output 2>err &&
254 - grep PGP output &&
254 + test_grep PGP output &&
255 test -s err
256
257 '
@@ -261,7 +261,7 @@ test_expect_success 'signed-tags=warn-verbatim' '
261 test_expect_success 'signed-tags=warn' '
262
263 git fast-export --signed-tags=warn sign-your-name >output 2>err &&
264 - grep PGP output &&
264 + test_grep PGP output &&
265 test -s err
266
267 '
@@ -269,13 +269,13 @@ test_expect_success 'signed-tags=warn' '
269 test_expect_success 'signed-tags=strip' '
270
271 git fast-export --signed-tags=strip sign-your-name > output &&
272 - ! grep PGP output
272 + test_grep ! PGP output
273
274 '
275
276 test_expect_success 'signed-tags=warn-strip' '
277 git fast-export --signed-tags=warn-strip sign-your-name >output 2>err &&
278 - ! grep PGP output &&
278 + test_grep ! PGP output &&
279 test -s err
280 '
281
@@ -345,7 +345,7 @@ test_expect_success GPG 'signed-commits=verbatim' '
345
346 git fast-export --signed-commits=verbatim --reencode=no commit-signing >output &&
347 test_grep -E "^gpgsig $GIT_DEFAULT_HASH openpgp" output &&
348 - grep "encoding ISO-8859-1" output &&
348 + test_grep "encoding ISO-8859-1" output &&
349 git -C new fast-import <output &&
350 STRIPPED=$(git -C new rev-parse --verify refs/heads/commit-signing) &&
351 test $COMMIT_SIGNING = $STRIPPED
@@ -356,7 +356,7 @@ test_expect_success GPG 'signed-commits=warn-verbatim' '
356
357 git fast-export --signed-commits=warn-verbatim --reencode=no commit-signing >output 2>err &&
358 test_grep -E "^gpgsig $GIT_DEFAULT_HASH openpgp" output &&
359 - grep "encoding ISO-8859-1" output &&
359 + test_grep "encoding ISO-8859-1" output &&
360 test -s err &&
361 git -C new fast-import <output &&
362 STRIPPED=$(git -C new rev-parse --verify refs/heads/commit-signing) &&
@@ -367,8 +367,8 @@ test_expect_success GPG 'signed-commits=warn-verbatim' '
367 test_expect_success GPG 'signed-commits=strip' '
368
369 git fast-export --signed-commits=strip --reencode=no commit-signing >output &&
370 - ! grep ^gpgsig output &&
371 - grep "^encoding ISO-8859-1" output &&
370 + test_grep ! ^gpgsig output &&
371 + test_grep "^encoding ISO-8859-1" output &&
372 sed "s/commit-signing/commit-strip-signing/" output | git -C new fast-import &&
373 STRIPPED=$(git -C new rev-parse --verify refs/heads/commit-strip-signing) &&
374 test $COMMIT_SIGNING != $STRIPPED
@@ -378,8 +378,8 @@ test_expect_success GPG 'signed-commits=strip' '
378 test_expect_success GPG 'signed-commits=warn-strip' '
379
380 git fast-export --signed-commits=warn-strip --reencode=no commit-signing >output 2>err &&
381 - ! grep ^gpgsig output &&
382 - grep "^encoding ISO-8859-1" output &&
381 + test_grep ! ^gpgsig output &&
382 + test_grep "^encoding ISO-8859-1" output &&
383 test -s err &&
384 sed "s/commit-signing/commit-strip-signing/" output | git -C new fast-import &&
385 STRIPPED=$(git -C new rev-parse --verify refs/heads/commit-strip-signing) &&
@@ -406,7 +406,7 @@ test_expect_success GPGSM 'round-trip X.509 signed commit' '
406 test_grep -E "^gpgsig $GIT_DEFAULT_HASH x509" output &&
407 git -C new fast-import <output &&
408 git -C new cat-file commit refs/heads/x509-signing >actual &&
409 - grep "^gpgsig" actual &&
409 + test_grep "^gpgsig" actual &&
410 IMPORTED=$(git -C new rev-parse refs/heads/x509-signing) &&
411 test $X509_COMMIT = $IMPORTED
412
@@ -431,7 +431,7 @@ test_expect_success GPGSSH 'round-trip SSH signed commit' '
431 test_grep -E "^gpgsig $GIT_DEFAULT_HASH ssh" output &&
432 git -C new fast-import <output &&
433 git -C new cat-file commit refs/heads/ssh-signing >actual &&
434 - grep "^gpgsig" actual &&
434 + test_grep "^gpgsig" actual &&
435 IMPORTED=$(git -C new rev-parse refs/heads/ssh-signing) &&
436 test $SSH_COMMIT = $IMPORTED
437
@@ -520,7 +520,7 @@ test_expect_success 'fast-export -C -C | fast-import' '
520 mkdir new &&
521 git --git-dir=new/.git init &&
522 git fast-export -C -C --signed-tags=strip --all > output &&
523 - grep "^C file2 file4\$" output &&
523 + test_grep "^C file2 file4\$" output &&
524 git -C new fast-import <output &&
525 test $ENTRY = $(git -C new rev-parse --verify refs/heads/copy)
526
@@ -548,11 +548,11 @@ test_expect_success 'cope with tagger-less tags' '
548 ANNOTATED_TAG_COUNT=$((ANNOTATED_TAG_COUNT + 1)) &&
549 git fast-export -C -C --signed-tags=strip --all > output &&
550 test $(grep -c "^tag " output) = $ANNOTATED_TAG_COUNT &&
551 - ! grep "Unspecified Tagger" output &&
551 + test_grep ! "Unspecified Tagger" output &&
552 git fast-export -C -C --signed-tags=strip --all \
553 --fake-missing-tagger > output &&
554 test $(grep -c "^tag " output) = $ANNOTATED_TAG_COUNT &&
555 - grep "Unspecified Tagger" output
555 + test_grep "Unspecified Tagger" output
556
557 '
558
@@ -628,7 +628,7 @@ test_expect_success 'rewrite tag predating pathspecs to nothing' '
628 test_commit bar &&
629
630 git fast-export --tag-of-filtered-object=rewrite --all -- bar.t >output &&
631 - grep from.$ZERO_OID output
631 + test_grep from.$ZERO_OID output
632 )
633 '
634
@@ -670,7 +670,7 @@ test_expect_success 'path limiting with import-marks does not lose unmodified fi
670 test_tick &&
671 git commit -mnext file &&
672 git fast-export --import-marks=marks simple -- file file0 >actual &&
673 - grep file0 actual
673 + test_grep file0 actual
674 '
675
676 test_expect_success 'path limiting works' '
@@ -753,7 +753,7 @@ test_expect_success 'handling tags of blobs' '
753 test_expect_success 'handling nested tags' '
754 git tag -a -m "This is a nested tag" nested muss &&
755 git fast-export --mark-tags nested >output &&
756 - grep "^from $ZERO_OID$" output &&
756 + test_grep "^from $ZERO_OID$" output &&
757 grep "^tag nested$" output >tag_lines &&
758 test_line_count = 2 tag_lines
759 '
@@ -926,7 +926,7 @@ test_expect_success 'merge commit gets exported with --import-marks' '
926
927 echo ":1 $(git rev-parse HEAD^^)" >marks &&
928 git fast-export --import-marks=marks main >out &&
929 - grep Yeah out
929 + test_grep Yeah out
930 )
931 '
932
t/t9351-fast-export-anonymize.sh
+18 -18
@@ -33,44 +33,44 @@ test_expect_success 'export anonymized stream' '
33
34 # this also covers commit messages
35 test_expect_success 'stream omits path names' '
36 - ! grep base stream &&
37 - ! grep foo stream &&
38 - ! grep subdir stream &&
39 - ! grep bar stream &&
40 - ! grep xyzzy stream
36 + test_grep ! base stream &&
37 + test_grep ! foo stream &&
38 + test_grep ! subdir stream &&
39 + test_grep ! bar stream &&
40 + test_grep ! xyzzy stream
41 '
42
43 test_expect_success 'stream contains user-specified names' '
44 - grep retain-me stream &&
45 - ! grep should-not-appear stream &&
46 - grep custom-name stream
44 + test_grep retain-me stream &&
45 + test_grep ! should-not-appear stream &&
46 + test_grep custom-name stream
47 '
48
49 test_expect_success 'stream omits gitlink oids' '
50 # avoid relying on the whole oid to remain hash-agnostic; this is
51 # plenty to be unique within our test case
52 - ! grep a000000000000000000 stream
52 + test_grep ! a000000000000000000 stream
53 '
54
55 test_expect_success 'stream retains other as refname' '
56 - grep other stream
56 + test_grep other stream
57 '
58
59 test_expect_success 'stream omits other refnames' '
60 - ! grep main stream &&
61 - ! grep mytag stream &&
62 - ! grep longtag stream
60 + test_grep ! main stream &&
61 + test_grep ! mytag stream &&
62 + test_grep ! longtag stream
63 '
64
65 test_expect_success 'stream omits identities' '
66 - ! grep "$GIT_COMMITTER_NAME" stream &&
67 - ! grep "$GIT_COMMITTER_EMAIL" stream &&
68 - ! grep "$GIT_AUTHOR_NAME" stream &&
69 - ! grep "$GIT_AUTHOR_EMAIL" stream
66 + test_grep ! "$GIT_COMMITTER_NAME" stream &&
67 + test_grep ! "$GIT_COMMITTER_EMAIL" stream &&
68 + test_grep ! "$GIT_AUTHOR_NAME" stream &&
69 + test_grep ! "$GIT_AUTHOR_EMAIL" stream
70 '
71
72 test_expect_success 'stream omits tag message' '
73 - ! grep "annotated tag" stream
73 + test_grep ! "annotated tag" stream
74 '
75
76 # NOTE: we chdir to the new, anonymized repository
t/t9400-git-cvsserver-server.sh
+2 -2
@@ -254,7 +254,7 @@ test_expect_success 'gitcvs.enabled = false' \
254 else
255 true
256 fi &&
257 - grep "GITCVS emulation disabled" cvs.log &&
257 + test_grep "GITCVS emulation disabled" cvs.log &&
258 test ! -d cvswork2'
259
260 rm -fr cvswork2
@@ -276,7 +276,7 @@ test_expect_success 'gitcvs.ext.enabled = false' '
276 else
277 true
278 fi &&
279 - grep "GITCVS emulation disabled" cvs.log &&
279 + test_grep "GITCVS emulation disabled" cvs.log &&
280 test ! -d cvswork2
281 '
282
t/t9501-gitweb-standalone-http-status.sh
+29 -29
@@ -37,13 +37,13 @@ EOF
37 test_expect_success \
38 'snapshots: tgz only default format enabled' \
39 'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
40 - grep "Status: 200 OK" gitweb.output &&
40 + test_grep "Status: 200 OK" gitweb.output &&
41 gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tbz2" &&
42 - grep "403 - Unsupported snapshot format" gitweb.output &&
42 + test_grep "403 - Unsupported snapshot format" gitweb.output &&
43 gitweb_run "p=.git;a=snapshot;h=HEAD;sf=txz" &&
44 - grep "403 - Snapshot format not allowed" gitweb.output &&
44 + test_grep "403 - Snapshot format not allowed" gitweb.output &&
45 gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
46 - grep "403 - Unsupported snapshot format" gitweb.output'
46 + test_grep "403 - Unsupported snapshot format" gitweb.output'
47
48
49 cat >>gitweb_config.perl <<\EOF
@@ -53,13 +53,13 @@ EOF
53 test_expect_success \
54 'snapshots: all enabled in default, use default disabled value' \
55 'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
56 - grep "Status: 200 OK" gitweb.output &&
56 + test_grep "Status: 200 OK" gitweb.output &&
57 gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tbz2" &&
58 - grep "Status: 200 OK" gitweb.output &&
58 + test_grep "Status: 200 OK" gitweb.output &&
59 gitweb_run "p=.git;a=snapshot;h=HEAD;sf=txz" &&
60 - grep "403 - Snapshot format not allowed" gitweb.output &&
60 + test_grep "403 - Snapshot format not allowed" gitweb.output &&
61 gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
62 - grep "Status: 200 OK" gitweb.output'
62 + test_grep "Status: 200 OK" gitweb.output'
63
64
65 cat >>gitweb_config.perl <<\EOF
@@ -69,7 +69,7 @@ EOF
69 test_expect_success \
70 'snapshots: zip explicitly disabled' \
71 'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
72 - grep "403 - Snapshot format not allowed" gitweb.output'
72 + test_grep "403 - Snapshot format not allowed" gitweb.output'
73 test_debug 'cat gitweb.output'
74
75
@@ -80,7 +80,7 @@ EOF
80 test_expect_success \
81 'snapshots: tgz explicitly enabled' \
82 'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
83 - grep "Status: 200 OK" gitweb.output'
83 + test_grep "Status: 200 OK" gitweb.output'
84 test_debug 'cat gitweb.headers'
85
86
@@ -89,13 +89,13 @@ test_debug 'cat gitweb.headers'
89
90 test_expect_success 'snapshots: good tree-ish id' '
91 gitweb_run "p=.git;a=snapshot;h=main;sf=tgz" &&
92 - grep "Status: 200 OK" gitweb.output
92 + test_grep "Status: 200 OK" gitweb.output
93 '
94 test_debug 'cat gitweb.headers'
95
96 test_expect_success 'snapshots: bad tree-ish id' '
97 gitweb_run "p=.git;a=snapshot;h=frizzumFrazzum;sf=tgz" &&
98 - grep "404 - Object does not exist" gitweb.output
98 + test_grep "404 - Object does not exist" gitweb.output
99 '
100 test_debug 'cat gitweb.output'
101
@@ -105,20 +105,20 @@ test_expect_success 'snapshots: bad tree-ish id (tagged object)' '
105 test_tick && git commit -m "Object to be tagged" &&
106 git tag tagged-object $(git hash-object tag-object) &&
107 gitweb_run "p=.git;a=snapshot;h=tagged-object;sf=tgz" &&
108 - grep "400 - Object is not a tree-ish" gitweb.output
108 + test_grep "400 - Object is not a tree-ish" gitweb.output
109 '
110 test_debug 'cat gitweb.output'
111
112 test_expect_success 'snapshots: good object id' '
113 ID=$(git rev-parse --verify HEAD) &&
114 gitweb_run "p=.git;a=snapshot;h=$ID;sf=tgz" &&
115 - grep "Status: 200 OK" gitweb.output
115 + test_grep "Status: 200 OK" gitweb.output
116 '
117 test_debug 'cat gitweb.headers'
118
119 test_expect_success 'snapshots: bad object id' '
120 gitweb_run "p=.git;a=snapshot;h=abcdef01234;sf=tgz" &&
121 - grep "404 - Object does not exist" gitweb.output
121 + test_grep "404 - Object does not exist" gitweb.output
122 '
123 test_debug 'cat gitweb.output'
124
@@ -127,8 +127,8 @@ test_debug 'cat gitweb.output'
127
128 test_expect_success DATE_PARSER 'modification: feed last-modified' '
129 gitweb_run "p=.git;a=atom;h=main" &&
130 - grep "Status: 200 OK" gitweb.headers &&
131 - grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
130 + test_grep "Status: 200 OK" gitweb.headers &&
131 + test_grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
132 '
133 test_debug 'cat gitweb.headers'
134
@@ -137,7 +137,7 @@ test_expect_success DATE_PARSER 'modification: feed if-modified-since (modified)
137 export HTTP_IF_MODIFIED_SINCE &&
138 test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
139 gitweb_run "p=.git;a=atom;h=main" &&
140 - grep "Status: 200 OK" gitweb.headers
140 + test_grep "Status: 200 OK" gitweb.headers
141 '
142 test_debug 'cat gitweb.headers'
143
@@ -146,14 +146,14 @@ test_expect_success DATE_PARSER 'modification: feed if-modified-since (unmodifie
146 export HTTP_IF_MODIFIED_SINCE &&
147 test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
148 gitweb_run "p=.git;a=atom;h=main" &&
149 - grep "Status: 304 Not Modified" gitweb.headers
149 + test_grep "Status: 304 Not Modified" gitweb.headers
150 '
151 test_debug 'cat gitweb.headers'
152
153 test_expect_success DATE_PARSER 'modification: snapshot last-modified' '
154 gitweb_run "p=.git;a=snapshot;h=main;sf=tgz" &&
155 - grep "Status: 200 OK" gitweb.headers &&
156 - grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
155 + test_grep "Status: 200 OK" gitweb.headers &&
156 + test_grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
157 '
158 test_debug 'cat gitweb.headers'
159
@@ -162,7 +162,7 @@ test_expect_success DATE_PARSER 'modification: snapshot if-modified-since (modif
162 export HTTP_IF_MODIFIED_SINCE &&
163 test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
164 gitweb_run "p=.git;a=snapshot;h=main;sf=tgz" &&
165 - grep "Status: 200 OK" gitweb.headers
165 + test_grep "Status: 200 OK" gitweb.headers
166 '
167 test_debug 'cat gitweb.headers'
168
@@ -171,7 +171,7 @@ test_expect_success DATE_PARSER 'modification: snapshot if-modified-since (unmod
171 export HTTP_IF_MODIFIED_SINCE &&
172 test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
173 gitweb_run "p=.git;a=snapshot;h=main;sf=tgz" &&
174 - grep "Status: 304 Not Modified" gitweb.headers
174 + test_grep "Status: 304 Not Modified" gitweb.headers
175 '
176 test_debug 'cat gitweb.headers'
177
@@ -181,8 +181,8 @@ test_expect_success DATE_PARSER 'modification: tree snapshot' '
181 export HTTP_IF_MODIFIED_SINCE &&
182 test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
183 gitweb_run "p=.git;a=snapshot;h=$ID;sf=tgz" &&
184 - grep "Status: 200 OK" gitweb.headers &&
185 - ! grep -i "last-modified" gitweb.headers
184 + test_grep "Status: 200 OK" gitweb.headers &&
185 + test_grep ! -i "last-modified" gitweb.headers
186 '
187 test_debug 'cat gitweb.headers'
188
@@ -196,8 +196,8 @@ EOF
196
197 test_expect_success 'load checking: load too high (default action)' '
198 gitweb_run "p=.git" &&
199 - grep "Status: 503 Service Unavailable" gitweb.headers &&
200 - grep "503 - The load average on the server is too high" gitweb.body
199 + test_grep "Status: 503 Service Unavailable" gitweb.headers &&
200 + test_grep "503 - The load average on the server is too high" gitweb.body
201 '
202 test_debug 'cat gitweb.headers'
203
@@ -212,8 +212,8 @@ EOF
212
213 test_expect_success 'invalid arguments: invalid regexp (in project search)' '
214 gitweb_run "a=project_list;s=*\.git;sr=1" &&
215 - grep "Status: 400" gitweb.headers &&
216 - grep "400 - Invalid.*regexp" gitweb.body
215 + test_grep "Status: 400" gitweb.headers &&
216 + test_grep "400 - Invalid.*regexp" gitweb.body
217 '
218 test_debug 'cat gitweb.headers'
219
t/t9502-gitweb-standalone-parse-output.sh
+19 -19
@@ -111,7 +111,7 @@ test_debug 'cat gitweb.headers && cat file_list'
111
112 test_expect_success 'snapshot: hierarchical branch name (xx/test)' '
113 gitweb_run "p=.git;a=snapshot;h=xx/test;sf=tar" &&
114 - ! grep "filename=.*/" gitweb.headers
114 + test_grep ! "filename=.*/" gitweb.headers
115 '
116 test_debug 'cat gitweb.headers'
117
@@ -139,13 +139,13 @@ test_expect_success 'forks: setup' '
139
140 test_expect_success 'forks: not skipped unless "forks" feature enabled' '
141 gitweb_run "a=project_list" &&
142 - grep -q ">\\.git<" gitweb.body &&
143 - grep -q ">foo\\.git<" gitweb.body &&
144 - grep -q ">foo_baz\\.git<" gitweb.body &&
145 - grep -q ">foo\\.bar\\.git<" gitweb.body &&
146 - grep -q ">foo_baz\\.git<" gitweb.body &&
147 - grep -q ">foo/foo-forked\\.git<" gitweb.body &&
148 - grep -q ">fork of .*<" gitweb.body
142 + test_grep -q ">\\.git<" gitweb.body &&
143 + test_grep -q ">foo\\.git<" gitweb.body &&
144 + test_grep -q ">foo_baz\\.git<" gitweb.body &&
145 + test_grep -q ">foo\\.bar\\.git<" gitweb.body &&
146 + test_grep -q ">foo_baz\\.git<" gitweb.body &&
147 + test_grep -q ">foo/foo-forked\\.git<" gitweb.body &&
148 + test_grep -q ">fork of .*<" gitweb.body
149 '
150
151 test_expect_success 'enable forks feature' '
@@ -156,25 +156,25 @@ test_expect_success 'enable forks feature' '
156
157 test_expect_success 'forks: forks skipped if "forks" feature enabled' '
158 gitweb_run "a=project_list" &&
159 - grep -q ">\\.git<" gitweb.body &&
160 - grep -q ">foo\\.git<" gitweb.body &&
161 - grep -q ">foo_baz\\.git<" gitweb.body &&
162 - grep -q ">foo\\.bar\\.git<" gitweb.body &&
163 - grep -q ">foo_baz\\.git<" gitweb.body &&
164 - grep -v ">foo/foo-forked\\.git<" gitweb.body &&
165 - grep -v ">fork of .*<" gitweb.body
159 + test_grep -q ">\\.git<" gitweb.body &&
160 + test_grep -q ">foo\\.git<" gitweb.body &&
161 + test_grep -q ">foo_baz\\.git<" gitweb.body &&
162 + test_grep -q ">foo\\.bar\\.git<" gitweb.body &&
163 + test_grep -q ">foo_baz\\.git<" gitweb.body &&
164 + test_grep -v ">foo/foo-forked\\.git<" gitweb.body &&
165 + test_grep -v ">fork of .*<" gitweb.body
166 '
167
168 test_expect_success 'forks: "forks" action for forked repository' '
169 gitweb_run "p=foo.git;a=forks" &&
170 - grep -q ">foo/foo-forked\\.git<" gitweb.body &&
171 - grep -q ">fork of foo<" gitweb.body
170 + test_grep -q ">foo/foo-forked\\.git<" gitweb.body &&
171 + test_grep -q ">fork of foo<" gitweb.body
172 '
173
174 test_expect_success 'forks: can access forked repository' '
175 gitweb_run "p=foo/foo-forked.git;a=summary" &&
176 - grep -q "200 OK" gitweb.headers &&
177 - grep -q ">fork of foo<" gitweb.body
176 + test_grep -q "200 OK" gitweb.headers &&
177 + test_grep -q ">fork of foo<" gitweb.body
178 '
179
180 test_expect_success 'forks: project_index lists all projects (incl. forks)' '
t/t9800-git-p4-basic.sh
+5 -5
@@ -35,7 +35,7 @@ test_expect_success 'basic git p4 clone' '
35
36 test_expect_success 'depot typo error' '
37 test_must_fail git p4 clone --dest="$git" /depot 2>errs &&
38 - grep "Depot paths must start with" errs
38 + test_grep "Depot paths must start with" errs
39 '
40
41 test_expect_success 'git p4 clone @all' '
@@ -356,7 +356,7 @@ test_expect_success 'unresolvable host in P4PORT should display error' '
356 P4PORT=nosuchhost:65537 &&
357 export P4PORT &&
358 test_expect_code 1 git p4 sync >out 2>err &&
359 - grep "connect to nosuchhost" err
359 + test_grep "connect to nosuchhost" err
360 )
361 '
362
@@ -374,7 +374,7 @@ test_expect_success 'run hook p4-pre-submit before submit' '
374 git commit -m "add hello.txt" &&
375 git config git-p4.skipSubmitEdit true &&
376 git p4 submit --dry-run >out &&
377 - grep "Would apply" out
377 + test_grep "Would apply" out
378 ) &&
379 test_hook -C "$git" p4-pre-submit <<-\EOF &&
380 exit 0
@@ -382,7 +382,7 @@ test_expect_success 'run hook p4-pre-submit before submit' '
382 (
383 cd "$git" &&
384 git p4 submit --dry-run >out &&
385 - grep "Would apply" out
385 + test_grep "Would apply" out
386 ) &&
387 test_hook -C "$git" --clobber p4-pre-submit <<-\EOF &&
388 exit 1
@@ -390,7 +390,7 @@ test_expect_success 'run hook p4-pre-submit before submit' '
390 (
391 cd "$git" &&
392 test_must_fail git p4 submit --dry-run >errs 2>&1 &&
393 - ! grep "Would apply" errs
393 + test_grep ! "Would apply" errs
394 )
395 '
396
t/t9801-git-p4-branch.sh
+24 -24
@@ -216,17 +216,17 @@ test_expect_success 'git p4 clone simple branches' '
216 test_path_is_file file1 &&
217 test_path_is_file file2 &&
218 test_path_is_file file3 &&
219 - grep update file2 &&
219 + test_grep update file2 &&
220 git reset --hard p4/depot/branch2 &&
221 test_path_is_file file1 &&
222 test_path_is_file file2 &&
223 test ! -f file3 &&
224 - ! grep update file2 &&
224 + test_grep ! update file2 &&
225 git reset --hard p4/depot/branch3 &&
226 test_path_is_file file1 &&
227 test_path_is_file file2 &&
228 test_path_is_file file3 &&
229 - grep update file2 &&
229 + test_grep update file2 &&
230 cd "$cli" &&
231 cd branch1 &&
232 p4 edit file2 &&
@@ -235,7 +235,7 @@ test_expect_success 'git p4 clone simple branches' '
235 cd "$git" &&
236 git reset --hard p4/depot/branch1 &&
237 git p4 rebase &&
238 - grep file2_ file2
238 + test_grep file2_ file2
239 )
240 '
241
@@ -292,29 +292,29 @@ test_expect_success 'git p4 clone complex branches' '
292 test_path_is_file file1 &&
293 test_path_is_file file2 &&
294 test_path_is_file file3 &&
295 - grep update file2 &&
295 + test_grep update file2 &&
296 git reset --hard p4/depot/branch2 &&
297 test_path_is_file file1 &&
298 test_path_is_file file2 &&
299 test_path_is_missing file3 &&
300 - ! grep update file2 &&
300 + test_grep ! update file2 &&
301 git reset --hard p4/depot/branch3 &&
302 test_path_is_file file1 &&
303 test_path_is_file file2 &&
304 test_path_is_file file3 &&
305 - grep update file2 &&
305 + test_grep update file2 &&
306 git reset --hard p4/depot/branch4 &&
307 git diff-tree --quiet HEAD &&
308 test_path_is_file file1 &&
309 test_path_is_file file2 &&
310 test_path_is_missing file3 &&
311 - ! grep update file2 &&
311 + test_grep ! update file2 &&
312 git reset --hard p4/depot/branch5 &&
313 git diff-tree --quiet HEAD &&
314 test_path_is_file file1 &&
315 test_path_is_file file2 &&
316 test_path_is_file file3 &&
317 - ! grep update file2 &&
317 + test_grep ! update file2 &&
318 test_must_fail git show-ref --verify refs/git-p4-tmp
319 )
320 '
@@ -346,27 +346,27 @@ test_expect_success 'git p4 sync changes to two branches in the same changelist'
346 test_path_is_file file1 &&
347 test_path_is_file file2 &&
348 test_path_is_file file3 &&
349 - grep update file2 &&
349 + test_grep update file2 &&
350 git reset --hard p4/depot/branch2 &&
351 test_path_is_file file1 &&
352 test_path_is_file file2 &&
353 test_path_is_missing file3 &&
354 - ! grep update file2 &&
354 + test_grep ! update file2 &&
355 git reset --hard p4/depot/branch3 &&
356 test_path_is_file file1 &&
357 test_path_is_file file2 &&
358 test_path_is_missing file3 &&
359 - grep update file2 &&
359 + test_grep update file2 &&
360 git reset --hard p4/depot/branch4 &&
361 test_path_is_file file1 &&
362 test_path_is_file file2 &&
363 test_path_is_file file3 &&
364 - ! grep update file2 &&
364 + test_grep ! update file2 &&
365 git reset --hard p4/depot/branch5 &&
366 test_path_is_file file1 &&
367 test_path_is_file file2 &&
368 test_path_is_file file3 &&
369 - ! grep update file2 &&
369 + test_grep ! update file2 &&
370 test_must_fail git show-ref --verify refs/git-p4-tmp
371 )
372 '
@@ -398,27 +398,27 @@ test_expect_failure 'git p4 clone file subset branch' '
398 test_path_is_file file1 &&
399 test_path_is_file file2 &&
400 test_path_is_file file3 &&
401 - grep update file2 &&
401 + test_grep update file2 &&
402 git reset --hard p4/depot/branch2 &&
403 test_path_is_file file1 &&
404 test_path_is_file file2 &&
405 test_path_is_missing file3 &&
406 - ! grep update file2 &&
406 + test_grep ! update file2 &&
407 git reset --hard p4/depot/branch3 &&
408 test_path_is_file file1 &&
409 test_path_is_file file2 &&
410 test_path_is_missing file3 &&
411 - grep update file2 &&
411 + test_grep update file2 &&
412 git reset --hard p4/depot/branch4 &&
413 test_path_is_file file1 &&
414 test_path_is_file file2 &&
415 test_path_is_file file3 &&
416 - ! grep update file2 &&
416 + test_grep ! update file2 &&
417 git reset --hard p4/depot/branch5 &&
418 test_path_is_file file1 &&
419 test_path_is_file file2 &&
420 test_path_is_file file3 &&
421 - ! grep update file2 &&
421 + test_grep ! update file2 &&
422 git reset --hard p4/depot/branch6 &&
423 test_path_is_file file1 &&
424 test_path_is_missing file2 &&
@@ -622,19 +622,19 @@ test_expect_success 'git p4 clone simple branches with base folder on server sid
622 test_path_is_file file2 &&
623 test_path_is_file file3 &&
624 test_path_is_file sub_file1 &&
625 - grep update file2 &&
625 + test_grep update file2 &&
626 git reset --hard p4/depot/branch2 &&
627 test_path_is_file file1 &&
628 test_path_is_file file2 &&
629 test ! -f file3 &&
630 test_path_is_file sub_file1 &&
631 - ! grep update file2 &&
631 + test_grep ! update file2 &&
632 git reset --hard p4/depot/branch3 &&
633 test_path_is_file file1 &&
634 test_path_is_file file2 &&
635 test_path_is_file file3 &&
636 test_path_is_file sub_file1 &&
637 - grep update file2 &&
637 + test_grep update file2 &&
638 cd "$cli" &&
639 cd branch1 &&
640 p4 edit file2 &&
@@ -643,7 +643,7 @@ test_expect_success 'git p4 clone simple branches with base folder on server sid
643 cd "$git" &&
644 git reset --hard p4/depot/branch1 &&
645 git p4 rebase &&
646 - grep file2_ file2
646 + test_grep file2_ file2
647 )
648 '
649
@@ -661,7 +661,7 @@ test_expect_success 'Update a file in git side and submit to P4 using client vie
661 cd "$cli" &&
662 p4 sync ... &&
663 cd branch1 &&
664 - grep "client spec" file1
664 + test_grep "client spec" file1
665 )
666 '
667
t/t9806-git-p4-options.sh
+5 -5
@@ -49,7 +49,7 @@ test_expect_success 'sync when no master branch prints a nice error' '
49 (
50 cd "$git" &&
51 test_must_fail git p4 sync 2>err &&
52 - grep "Error: no branch refs/remotes/p4/master" err
52 + test_grep "Error: no branch refs/remotes/p4/master" err
53 )
54 '
55
@@ -85,9 +85,9 @@ test_expect_success 'sync when two branches but no master should noop' '
85 git p4 sync --branch=refs/remotes/p4/b2 //depot@2 &&
86 git p4 sync &&
87 git show -s --format=%s refs/remotes/p4/b1 >show &&
88 - grep "Initial import" show &&
88 + test_grep "Initial import" show &&
89 git show -s --format=%s refs/remotes/p4/b2 >show &&
90 - grep "Initial import" show
90 + test_grep "Initial import" show
91 )
92 '
93
@@ -100,9 +100,9 @@ test_expect_success 'sync --branch updates specific branch, no detection' '
100 git p4 sync --branch=b2 //depot@2 &&
101 git p4 sync --branch=b2 &&
102 git show -s --format=%s refs/remotes/p4/b1 >show &&
103 - grep "Initial import" show &&
103 + test_grep "Initial import" show &&
104 git show -s --format=%s refs/remotes/p4/b2 >show &&
105 - grep "change 3" show
105 + test_grep "change 3" show
106 )
107 '
108
t/t9807-git-p4-submit.sh
+1 -1
@@ -542,7 +542,7 @@ test_expect_success 'submit --update-shelve' '
542 cd "$cli" &&
543 change=$(last_shelve) &&
544 p4 unshelve -c $change -s $change &&
545 - grep -q updated-line shelf.t &&
545 + test_grep -q updated-line shelf.t &&
546 p4 describe -S $change | grep added-file.t &&
547 test_path_is_missing shelved-change-1.t &&
548 p4 revert ...
t/t9810-git-p4-rcs.sh
+4 -4
@@ -299,12 +299,12 @@ test_expect_success 'cope with rcs keyword file deletion' '
299 echo "\$Revision\$" >kwdelfile.c &&
300 p4 add -t ktext kwdelfile.c &&
301 p4 submit -d "Add file to be deleted" &&
302 - grep 1 kwdelfile.c
302 + test_grep 1 kwdelfile.c
303 ) &&
304 git p4 clone --dest="$git" //depot &&
305 (
306 cd "$git" &&
307 - grep Revision kwdelfile.c &&
307 + test_grep Revision kwdelfile.c &&
308 git rm -f kwdelfile.c &&
309 git commit -m "Delete a file containing RCS keywords" &&
310 git config git-p4.skipSubmitEdit true &&
@@ -336,7 +336,7 @@ test_expect_success 'Add keywords in git which match the default p4 values' '
336 cd "$cli" &&
337 p4 sync &&
338 test -f kwfile1.c &&
339 - grep "NewKW.*Revision.*[0-9]" kwfile1.c
339 + test_grep "NewKW.*Revision.*[0-9]" kwfile1.c
340
341 )
342 '
@@ -359,7 +359,7 @@ test_expect_failure 'Add keywords in git which do not match the default p4 value
359 (
360 cd "$cli" &&
361 p4 sync &&
362 - grep "NewKW2.*Revision.*[0-9]" kwfile1.c
362 + test_grep "NewKW2.*Revision.*[0-9]" kwfile1.c
363
364 )
365 '
t/t9813-git-p4-preserve-users.sh
+4 -4
@@ -119,20 +119,20 @@ test_expect_success 'not preserving user with mixed authorship' '
119 P4EDITOR=cat P4USER=alice P4PASSWD=secret &&
120 export P4EDITOR P4USER P4PASSWD &&
121 git p4 commit >actual &&
122 - grep "git author derek@example.com does not match" actual &&
122 + test_grep "git author derek@example.com does not match" actual &&
123
124 make_change_by_user usernamefile3 Charlie charlie@example.com &&
125 git p4 commit >actual &&
126 - grep "git author charlie@example.com does not match" actual &&
126 + test_grep "git author charlie@example.com does not match" actual &&
127
128 make_change_by_user usernamefile3 alice alice@example.com &&
129 git p4 commit >actual &&
130 - ! grep "git author.*does not match" actual &&
130 + test_grep ! "git author.*does not match" actual &&
131
132 git config git-p4.skipUserNameCheck true &&
133 make_change_by_user usernamefile3 Charlie charlie@example.com &&
134 git p4 commit >actual &&
135 - ! grep "git author.*does not match" actual &&
135 + test_grep ! "git author.*does not match" actual &&
136
137 p4_check_commit_author usernamefile3 alice
138 )
t/t9814-git-p4-rename.sh
+4 -4
@@ -66,7 +66,7 @@ test_expect_success 'detect renames' '
66 git diff-tree -r -M HEAD &&
67 git p4 submit &&
68 p4 filelog //depot/file4 >filelog &&
69 - ! grep " from //depot" filelog &&
69 + test_grep ! " from //depot" filelog &&
70
71 git mv file4 file5 &&
72 git commit -a -m "Rename file4 to file5" &&
@@ -74,7 +74,7 @@ test_expect_success 'detect renames' '
74 git config git-p4.detectRenames true &&
75 git p4 submit &&
76 p4 filelog //depot/file5 >filelog &&
77 - grep " from //depot/file4" filelog &&
77 + test_grep " from //depot/file4" filelog &&
78
79 git mv file5 file6 &&
80 echo update >>file6 &&
@@ -86,7 +86,7 @@ test_expect_success 'detect renames' '
86 git config git-p4.detectRenames $(($level + 2)) &&
87 git p4 submit &&
88 p4 filelog //depot/file6 >filelog &&
89 - ! grep " from //depot" filelog &&
89 + test_grep ! " from //depot" filelog &&
90
91 git mv file6 file7 &&
92 echo update >>file7 &&
@@ -98,7 +98,7 @@ test_expect_success 'detect renames' '
98 git config git-p4.detectRenames $(($level - 2)) &&
99 git p4 submit &&
100 p4 filelog //depot/file7 >filelog &&
101 - grep " from //depot/file6" filelog
101 + test_grep " from //depot/file6" filelog
102 )
103 '
104
t/t9827-git-p4-change-filetype.sh
+2 -2
@@ -36,7 +36,7 @@ test_expect_success SYMLINKS 'change file to symbolic link' '
36 git commit -m "symlink file1 to file2" &&
37 git p4 submit &&
38 p4 filelog -m 1 //depot/file2 >filelog &&
39 - grep "(symlink)" filelog
39 + test_grep "(symlink)" filelog
40 )
41 '
42
@@ -55,7 +55,7 @@ test_expect_success SYMLINKS 'change symbolic link to file' '
55 git commit -m "re-write file2" &&
56 git p4 submit &&
57 p4 filelog -m 1 //depot/file2 >filelog &&
58 - grep "(text)" filelog
58 + test_grep "(text)" filelog
59 )
60 '
61
t/t9832-unshelve.sh
+3 -3
@@ -69,7 +69,7 @@ EOF
69 change=$(last_shelved_change) &&
70 git p4 unshelve $change &&
71 git show refs/remotes/p4-unshelved/$change >actual &&
72 - grep -q "Further description" actual &&
72 + test_grep -q "Further description" actual &&
73 git cherry-pick refs/remotes/p4-unshelved/$change &&
74 test_path_is_file file2 &&
75 test_cmp file1 "$cli"/file1 &&
@@ -141,7 +141,7 @@ test_expect_success 'create shelved changelist based on p4 change ahead of p4/ma
141 shelve_one_file //depot/file1 &&
142 change=$(last_shelved_change) &&
143 p4 describe -S $change >out.txt &&
144 - grep -q "Change to be unshelved" out.txt
144 + test_grep -q "Change to be unshelved" out.txt
145 )
146 '
147
@@ -152,7 +152,7 @@ test_expect_success 'try to unshelve the change' '
152 change=$(last_shelved_change) &&
153 cd "$git" &&
154 git p4 unshelve $change >out.txt &&
155 - grep -q "unshelved changelist $change" out.txt
155 + test_grep -q "unshelved changelist $change" out.txt
156 )
157 '
158
t/t9833-errors.sh
+2 -2
@@ -29,7 +29,7 @@ test_expect_success 'error handling' '
29 P4PASSWD=badpassword &&
30 export P4PASSWD &&
31 test_must_fail git p4 clone //depot/foo 2>errmsg &&
32 - grep -q "failure accessing depot.*P4PASSWD" errmsg
32 + test_grep -q "failure accessing depot.*P4PASSWD" errmsg
33 )
34 '
35
@@ -41,7 +41,7 @@ test_expect_success 'ticket logged out' '
41 test_commit "ticket-auth-check" &&
42 p4 logout &&
43 test_must_fail git p4 submit 2>errmsg &&
44 - grep -q "failure accessing depot" errmsg
44 + test_grep -q "failure accessing depot" errmsg
45 )
46 '
47
t/t9835-git-p4-metadata-encoding-python2.sh
+18 -18
@@ -84,7 +84,7 @@ test_expect_success 'clone non-utf8 repo with strict encoding' '
84 test_when_finished cleanup_git &&
85 test_when_finished remove_user_cache &&
86 test_must_fail git -c git-p4.metadataDecodingStrategy=strict p4-python2 clone --dest="$git" //depot@all 2>err &&
87 - grep "Decoding perforce metadata failed!" err
87 + test_grep "Decoding perforce metadata failed!" err
88 '
89
90 test_expect_success 'check utf-8 contents with passthrough strategy' '
@@ -94,8 +94,8 @@ test_expect_success 'check utf-8 contents with passthrough strategy' '
94 (
95 cd "$git" &&
96 git log >actual &&
97 - grep "some utf-8 tǣxt" actual &&
98 - grep "ǣuthor" actual
97 + test_grep "some utf-8 tǣxt" actual &&
98 + test_grep "ǣuthor" actual
99 )
100 '
101
@@ -107,9 +107,9 @@ test_expect_success 'check latin-1 contents corrupted in git with passthrough st
107 cd "$git" &&
108 git log >actual &&
109 badly_encoded_in_git=$(echo "some latin-1 tæxt" | iconv -f utf8 -t latin1) &&
110 - grep "$badly_encoded_in_git" actual &&
110 + test_grep "$badly_encoded_in_git" actual &&
111 bad_author_in_git="$(echo æuthor | iconv -f utf8 -t latin1)" &&
112 - grep "$bad_author_in_git" actual
112 + test_grep "$bad_author_in_git" actual
113 )
114 '
115
@@ -120,8 +120,8 @@ test_expect_success 'check utf-8 contents with fallback strategy' '
120 (
121 cd "$git" &&
122 git log >actual &&
123 - grep "some utf-8 tǣxt" actual &&
124 - grep "ǣuthor" actual
123 + test_grep "some utf-8 tǣxt" actual &&
124 + test_grep "ǣuthor" actual
125 )
126 '
127
@@ -132,8 +132,8 @@ test_expect_success 'check latin-1 contents with fallback strategy' '
132 (
133 cd "$git" &&
134 git log >actual &&
135 - grep "some latin-1 tæxt" actual &&
136 - grep "æuthor" actual
135 + test_grep "some latin-1 tæxt" actual &&
136 + test_grep "æuthor" actual
137 )
138 '
139
@@ -144,8 +144,8 @@ test_expect_success 'check cp-1252 contents with fallback strategy' '
144 (
145 cd "$git" &&
146 git log >actual &&
147 - grep "sœme cp-1252 tæxt" actual &&
148 - grep "æuthœr" actual
147 + test_grep "sœme cp-1252 tæxt" actual &&
148 + test_grep "æuthœr" actual
149 )
150 '
151
@@ -156,8 +156,8 @@ test_expect_success 'check cp850 contents parsed with correct fallback' '
156 (
157 cd "$git" &&
158 git log >actual &&
159 - grep "hÅs some cp850 text" actual &&
160 - grep "Åuthor" actual
159 + test_grep "hÅs some cp850 text" actual &&
160 + test_grep "Åuthor" actual
161 )
162 '
163
@@ -168,8 +168,8 @@ test_expect_success 'check cp850-only contents escaped when cp1252 is fallback'
168 (
169 cd "$git" &&
170 git log >actual &&
171 - grep "h%8Fs some cp850 text" actual &&
172 - grep "%8Futhor" actual
171 + test_grep "h%8Fs some cp850 text" actual &&
172 + test_grep "%8Futhor" actual
173 )
174 '
175
@@ -191,8 +191,8 @@ test_expect_success 'check cp-1252 contents on later sync after clone with fallb
191 git p4-python2 sync --branch=master &&
192
193 git log p4/master >actual &&
194 - grep "sœme more cp-1252 tæxt" actual &&
195 - grep "æuthœr" actual
194 + test_grep "sœme more cp-1252 tæxt" actual &&
195 + test_grep "æuthœr" actual
196 )
197 '
198
@@ -208,7 +208,7 @@ test_expect_success 'passthrough (latin-1 contents corrupted in git) is the defa
208 cd "$git" &&
209 git log >actual &&
210 badly_encoded_in_git=$(echo "some latin-1 tæxt" | iconv -f utf8 -t latin1) &&
211 - grep "$badly_encoded_in_git" actual
211 + test_grep "$badly_encoded_in_git" actual
212 )
213 '
214
t/t9836-git-p4-metadata-encoding-python3.sh
+19 -19
@@ -84,7 +84,7 @@ test_expect_success 'clone non-utf8 repo with strict encoding' '
84 test_when_finished cleanup_git &&
85 test_when_finished remove_user_cache &&
86 test_must_fail git -c git-p4.metadataDecodingStrategy=strict p4-python3 clone --dest="$git" //depot@all 2>err &&
87 - grep "Decoding perforce metadata failed!" err
87 + test_grep "Decoding perforce metadata failed!" err
88 '
89
90 test_expect_success 'check utf-8 contents with passthrough strategy' '
@@ -94,8 +94,8 @@ test_expect_success 'check utf-8 contents with passthrough strategy' '
94 (
95 cd "$git" &&
96 git log >actual &&
97 - grep "some utf-8 tǣxt" actual &&
98 - grep "ǣuthor" actual
97 + test_grep "some utf-8 tǣxt" actual &&
98 + test_grep "ǣuthor" actual
99 )
100 '
101
@@ -107,9 +107,9 @@ test_expect_success 'check latin-1 contents corrupted in git with passthrough st
107 cd "$git" &&
108 git log >actual &&
109 badly_encoded_in_git=$(echo "some latin-1 tæxt" | iconv -f utf8 -t latin1) &&
110 - grep "$badly_encoded_in_git" actual &&
110 + test_grep "$badly_encoded_in_git" actual &&
111 bad_author_in_git="$(echo æuthor | iconv -f utf8 -t latin1)" &&
112 - grep "$bad_author_in_git" actual
112 + test_grep "$bad_author_in_git" actual
113 )
114 '
115
@@ -120,8 +120,8 @@ test_expect_success 'check utf-8 contents with fallback strategy' '
120 (
121 cd "$git" &&
122 git log >actual &&
123 - grep "some utf-8 tǣxt" actual &&
124 - grep "ǣuthor" actual
123 + test_grep "some utf-8 tǣxt" actual &&
124 + test_grep "ǣuthor" actual
125 )
126 '
127
@@ -132,8 +132,8 @@ test_expect_success 'check latin-1 contents with fallback strategy' '
132 (
133 cd "$git" &&
134 git log >actual &&
135 - grep "some latin-1 tæxt" actual &&
136 - grep "æuthor" actual
135 + test_grep "some latin-1 tæxt" actual &&
136 + test_grep "æuthor" actual
137 )
138 '
139
@@ -144,8 +144,8 @@ test_expect_success 'check cp-1252 contents with fallback strategy' '
144 (
145 cd "$git" &&
146 git log >actual &&
147 - grep "sœme cp-1252 tæxt" actual &&
148 - grep "æuthœr" actual
147 + test_grep "sœme cp-1252 tæxt" actual &&
148 + test_grep "æuthœr" actual
149 )
150 '
151
@@ -156,8 +156,8 @@ test_expect_success 'check cp850 contents parsed with correct fallback' '
156 (
157 cd "$git" &&
158 git log >actual &&
159 - grep "hÅs some cp850 text" actual &&
160 - grep "Åuthor" actual
159 + test_grep "hÅs some cp850 text" actual &&
160 + test_grep "Åuthor" actual
161 )
162 '
163
@@ -168,8 +168,8 @@ test_expect_success 'check cp850-only contents escaped when cp1252 is fallback'
168 (
169 cd "$git" &&
170 git log >actual &&
171 - grep "h%8Fs some cp850 text" actual &&
172 - grep "%8Futhor" actual
171 + test_grep "h%8Fs some cp850 text" actual &&
172 + test_grep "%8Futhor" actual
173 )
174 '
175
@@ -191,8 +191,8 @@ test_expect_success 'check cp-1252 contents on later sync after clone with fallb
191 git p4-python3 sync --branch=master &&
192
193 git log p4/master >actual &&
194 - grep "sœme more cp-1252 tæxt" actual &&
195 - grep "æuthœr" actual
194 + test_grep "sœme more cp-1252 tæxt" actual &&
195 + test_grep "æuthœr" actual
196 )
197 '
198
@@ -208,8 +208,8 @@ test_expect_success 'fallback (both utf-8 and cp-1252 contents handled) is the d
208 (
209 cd "$git" &&
210 git log >actual &&
211 - grep "sœme cp-1252 tæxt" actual &&
212 - grep "æuthœr" actual
211 + test_grep "sœme cp-1252 tæxt" actual &&
212 + test_grep "æuthœr" actual
213 )
214 '
215
t/t9850-shell.sh
+1 -1
@@ -32,7 +32,7 @@ test_expect_success 'shell allows interactive command' '
32 test_expect_success 'shell complains of overlong commands' '
33 test-tool genzeros | tr "\000" "a" |
34 test_must_fail git shell 2>err &&
35 - grep "too long" err
35 + test_grep "too long" err
36 '
37
38 test_done
t/t9902-completion.sh
+13 -13
@@ -1381,7 +1381,7 @@ test_expect_success '__git_complete_worktree_paths' '
1381 test_when_finished "git worktree remove other_wt" &&
1382 git worktree add --orphan other_wt &&
1383 run_completion "git worktree remove " &&
1384 - grep other_wt out
1384 + test_grep other_wt out
1385 '
1386
1387 test_expect_success '__git_complete_worktree_paths - not a git repository' '
@@ -1397,7 +1397,7 @@ test_expect_success '__git_complete_worktree_paths with -C' '
1397 test_when_finished "git -C otherrepo worktree remove otherrepo_wt" &&
1398 git -C otherrepo worktree add --orphan otherrepo_wt &&
1399 run_completion "git -C otherrepo worktree remove " &&
1400 - grep otherrepo_wt out
1400 + test_grep otherrepo_wt out
1401 '
1402
1403 test_expect_success 'git switch - with no options, complete local branches and unique remote branch names for DWIM logic' '
@@ -2554,14 +2554,14 @@ test_expect_success '__git_pretty_aliases' '
2554 test_expect_success 'basic' '
2555 run_completion "git " &&
2556 # built-in
2557 - grep -q "^add \$" out &&
2557 + test_grep -q "^add \$" out &&
2558 # script
2559 - grep -q "^rebase \$" out &&
2559 + test_grep -q "^rebase \$" out &&
2560 # plumbing
2561 - ! grep -q "^ls-files \$" out &&
2561 + test_grep ! -q "^ls-files \$" out &&
2562
2563 run_completion "git r" &&
2564 - ! grep -q -v "^r" out
2564 + test_grep ! -q -v "^r" out
2565 '
2566
2567 test_expect_success 'double dash "git" itself' '
@@ -2656,7 +2656,7 @@ test_expect_success 'git --help completion' '
2656 test_expect_success 'completion.commands removes multiple commands' '
2657 test_config completion.commands "-cherry -mergetool" &&
2658 git --list-cmds=list-mainporcelain,list-complete,config >out &&
2659 - ! grep -E "^(cherry|mergetool)$" out
2659 + test_grep ! -E "^(cherry|mergetool)$" out
2660 '
2661
2662 test_expect_success 'setup for integration tests' '
@@ -3179,8 +3179,8 @@ test_expect_success 'plumbing commands are excluded without GIT_COMPLETION_SHOW_
3179
3180 # Just mainporcelain, not plumbing commands
3181 run_completion "git c" &&
3182 - grep checkout out &&
3183 - ! grep cat-file out
3182 + test_grep checkout out &&
3183 + test_grep ! cat-file out
3184 )
3185 '
3186
@@ -3193,13 +3193,13 @@ test_expect_success 'all commands are shown with GIT_COMPLETION_SHOW_ALL_COMMAND
3193
3194 # Both mainporcelain and plumbing commands
3195 run_completion "git c" &&
3196 - grep checkout out &&
3197 - grep cat-file out &&
3196 + test_grep checkout out &&
3197 + test_grep cat-file out &&
3198
3199 # Check "gitk", a "main" command, but not a built-in + more plumbing
3200 run_completion "git g" &&
3201 - grep gitk out &&
3202 - grep get-tar-commit-id out
3201 + test_grep gitk out &&
3202 + test_grep get-tar-commit-id out
3203 )
3204 '
3205