Git fork

t: use test_grep in t3701 and t4055

As a preparatory clean-up, use the "test_grep" test utility instead of
regular "grep" which provides better debug information if tests fail.

Signed-off-by: Leon Michalak <leonmichalak6@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Leon Michalak and committed by
Junio C Hamano
671b2839 16bd9f20

+38 -38
+24 -24
t/t3701-add-interactive.sh
··· 63 63 ' 64 64 test_expect_success 'status works (initial)' ' 65 65 git add -i </dev/null >output && 66 - grep "+1/-0 *+2/-0 file" output 66 + test_grep "+1/-0 *+2/-0 file" output 67 67 ' 68 68 69 69 test_expect_success 'setup expected' ' ··· 86 86 git add file && 87 87 test_write_lines r 1 | git add -i && 88 88 git ls-files >output && 89 - ! grep . output 89 + test_grep ! . output 90 90 ' 91 91 92 92 test_expect_success 'add untracked (multiple)' ' ··· 109 109 ' 110 110 test_expect_success 'status works (commit)' ' 111 111 git add -i </dev/null >output && 112 - grep "+1/-0 *+2/-0 file" output 112 + test_grep "+1/-0 *+2/-0 file" output 113 113 ' 114 114 115 115 test_expect_success 'update can stage deletions' ' ··· 141 141 git add file && 142 142 test_write_lines r 1 | git add -i && 143 143 git add -i </dev/null >output && 144 - grep "unchanged *+3/-0 file" output 144 + test_grep "unchanged *+3/-0 file" output 145 145 ' 146 146 147 147 test_expect_success 'reject multi-key input' ' ··· 185 185 test_expect_success 'bad edit rejected' ' 186 186 git reset && 187 187 test_write_lines e n d | git add -p >output && 188 - grep "hunk does not apply" output 188 + test_grep "hunk does not apply" output 189 189 ' 190 190 191 191 test_expect_success 'setup patch' ' ··· 198 198 test_expect_success 'garbage edit rejected' ' 199 199 git reset && 200 200 test_write_lines e n d | git add -p >output && 201 - grep "hunk does not apply" output 201 + test_grep "hunk does not apply" output 202 202 ' 203 203 204 204 test_expect_success 'setup patch' ' ··· 313 313 chmod +x file && 314 314 printf "y\\ny\\n" | git add -p && 315 315 git diff --cached file >out && 316 - grep "new mode" out && 317 - grep "+content" out && 316 + test_grep "new mode" out && 317 + test_grep "+content" out && 318 318 git diff file >out && 319 319 test_must_be_empty out 320 320 ' ··· 636 636 printf "%s\n" s e q n q q | 637 637 EDITOR=: git add -p && 638 638 git diff >actual && 639 - ! grep "^+15" actual 639 + test_grep ! "^+15" actual 640 640 ' 641 641 642 642 test_expect_success 'split hunk "add -p (no, yes, edit)"' ' ··· 648 648 EDITOR=: git add -p 2>error && 649 649 test_must_be_empty error && 650 650 git diff >actual && 651 - ! grep "^+31" actual 651 + test_grep ! "^+31" actual 652 652 ' 653 653 654 654 test_expect_success 'split hunk with incomplete line at end' ' ··· 682 682 EDITOR=./fake_editor.sh git add -p 2>error && 683 683 test_must_be_empty error && 684 684 git diff --cached >actual && 685 - grep "^+22" actual 685 + test_grep "^+22" actual 686 686 ' 687 687 688 688 test_expect_success 'patch mode ignores unmerged entries' ' ··· 696 696 test_must_fail git merge side && 697 697 echo changed >non-conflict.t && 698 698 echo y | git add -p >output && 699 - ! grep a/conflict.t output && 699 + test_grep ! a/conflict.t output && 700 700 cat >expected <<-\EOF && 701 701 * Unmerged path conflict.t 702 702 diff --git a/non-conflict.t b/non-conflict.t ··· 728 728 729 729 # We do not want to depend on the exact coloring scheme 730 730 # git uses for diffs, so just check that we saw some kind of color. 731 - grep "$(printf "\\033")" output 731 + test_grep "$(printf "\\033")" output 732 732 ' 733 733 734 734 test_expect_success 'colors can be overridden' ' ··· 743 743 -c color.interactive.error=blue \ 744 744 add -i 2>err.raw <input && 745 745 test_decode_color <err.raw >err && 746 - grep "<BLUE>Huh (trigger)?<RESET>" err && 746 + test_grep "<BLUE>Huh (trigger)?<RESET>" err && 747 747 748 748 test_write_lines help quit >input && 749 749 force_color git \ ··· 863 863 printf y >y && 864 864 force_color git -c diff.wsErrorHighlight=all add -p >output.raw 2>&1 <y && 865 865 test_decode_color <output.raw >output && 866 - grep "old<" output 866 + test_grep "old<" output 867 867 ' 868 868 869 869 test_expect_success 'diffFilter filters diff' ' ··· 876 876 877 877 # avoid depending on the exact coloring or content of the prompts, 878 878 # and just make sure we saw our diff prefixed 879 - grep foo:.*content output 879 + test_grep foo:.*content output 880 880 ' 881 881 882 882 test_expect_success 'detect bogus diffFilter output' ' ··· 886 886 test_config interactive.diffFilter "sed 6d" && 887 887 printf y >y && 888 888 force_color test_must_fail git add -p <y >output 2>&1 && 889 - grep "mismatched output" output 889 + test_grep "mismatched output" output 890 890 ' 891 891 892 892 test_expect_success 'handle iffy colored hunk headers' ' ··· 896 896 printf n >n && 897 897 force_color git -c interactive.diffFilter="sed s/.*@@.*/XX/" \ 898 898 add -p >output 2>&1 <n && 899 - grep "^XX$" output 899 + test_grep "^XX$" output 900 900 ' 901 901 902 902 test_expect_success 'handle very large filtered diff' ' ··· 1002 1002 # update it, but we want to be sure that our "." pathspec 1003 1003 # was not expanded into the argument list of any command. 1004 1004 # So look only for "not-changed". 1005 - ! grep -E "^trace: (built-in|exec|run_command): .*not-changed" trace.out 1005 + test_grep ! -E "^trace: (built-in|exec|run_command): .*not-changed" trace.out 1006 1006 ' 1007 1007 1008 1008 test_expect_success 'hunk-editing handles custom comment char' ' ··· 1072 1072 1073 1073 test_expect_success 'status ignores dirty submodules (except HEAD)' ' 1074 1074 git -C for-submodules add -i </dev/null >output && 1075 - grep dirty-head output && 1076 - grep dirty-both-ways output && 1077 - ! grep dirty-otherwise output 1075 + test_grep dirty-head output && 1076 + test_grep dirty-both-ways output && 1077 + test_grep ! dirty-otherwise output 1078 1078 ' 1079 1079 1080 1080 test_expect_success 'handle submodules' ' 1081 1081 echo 123 >>for-submodules/dirty-otherwise/initial.t && 1082 1082 1083 1083 force_color git -C for-submodules add -p dirty-otherwise >output 2>&1 && 1084 - grep "No changes" output && 1084 + test_grep "No changes" output && 1085 1085 1086 1086 force_color git -C for-submodules add -p dirty-head >output 2>&1 <y && 1087 1087 git -C for-submodules ls-files --stage dirty-head >actual && 1088 1088 rev="$(git -C for-submodules/dirty-head rev-parse HEAD)" && 1089 - grep "$rev" actual 1089 + test_grep "$rev" actual 1090 1090 ' 1091 1091 1092 1092 test_expect_success 'set up pathological context' '
+14 -14
t/t4055-diff-context.sh
··· 38 38 39 39 test_expect_success 'the default number of context lines is 3' ' 40 40 git diff >output && 41 - ! grep "^ d" output && 42 - grep "^ e" output && 43 - grep "^ j" output && 44 - ! grep "^ k" output 41 + test_grep ! "^ d" output && 42 + test_grep "^ e" output && 43 + test_grep "^ j" output && 44 + test_grep ! "^ k" output 45 45 ' 46 46 47 47 test_expect_success 'diff.context honored by "log"' ' 48 48 git log -1 -p >output && 49 - ! grep firstline output && 49 + test_grep ! firstline output && 50 50 git config diff.context 8 && 51 51 git log -1 -p >output && 52 - grep "^ firstline" output 52 + test_grep "^ firstline" output 53 53 ' 54 54 55 55 test_expect_success 'The -U option overrides diff.context' ' 56 56 git config diff.context 8 && 57 57 git log -U4 -1 >output && 58 - ! grep "^ firstline" output 58 + test_grep ! "^ firstline" output 59 59 ' 60 60 61 61 test_expect_success 'diff.context honored by "diff"' ' 62 62 git config diff.context 8 && 63 63 git diff >output && 64 - grep "^ firstline" output 64 + test_grep "^ firstline" output 65 65 ' 66 66 67 67 test_expect_success 'plumbing not affected' ' 68 68 git config diff.context 8 && 69 69 git diff-files -p >output && 70 - ! grep "^ firstline" output 70 + test_grep ! "^ firstline" output 71 71 ' 72 72 73 73 test_expect_success 'non-integer config parsing' ' ··· 85 85 test_expect_success '-U0 is valid, so is diff.context=0' ' 86 86 git config diff.context 0 && 87 87 git diff >output && 88 - grep "^-ADDED" output && 89 - grep "^+MODIFIED" output 88 + test_grep "^-ADDED" output && 89 + test_grep "^+MODIFIED" output 90 90 ' 91 91 92 92 test_expect_success '-U2147483647 works' ' ··· 94 94 test_line_count = 16 x && 95 95 git diff -U2147483647 >output && 96 96 test_line_count = 22 output && 97 - grep "^-ADDED" output && 98 - grep "^+MODIFIED" output && 99 - grep "^+APPENDED" output 97 + test_grep "^-ADDED" output && 98 + test_grep "^+MODIFIED" output && 99 + test_grep "^+APPENDED" output 100 100 ' 101 101 102 102 test_done