don't use test_must_fail with grep
test_must_fail should only be used for testing git commands. To test the failure of other commands use `!`. Reported-by: Stefan Beller <sbeller@google.com> Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pranit Bauva committed
Jan 4, 2017 at 01:27 UTC
c7cf956618c4af9f3151a90d7552b05767e6444f
10 files changed
+22
-22
t/t3510-cherry-pick-sequence.sh
+3
-3
@@ -375,7 +375,7 @@ test_expect_success '--continue respects opts' '
375
git cat-file commit HEAD~1 >picked_msg &&
376
git cat-file commit HEAD~2 >unrelatedpick_msg &&
377
git cat-file commit HEAD~3 >initial_msg &&
378
- test_must_fail grep "cherry picked from" initial_msg &&
378
+ ! grep "cherry picked from" initial_msg &&
379
grep "cherry picked from" unrelatedpick_msg &&
380
grep "cherry picked from" picked_msg &&
381
grep "cherry picked from" anotherpick_msg
@@ -416,9 +416,9 @@ test_expect_failure '--signoff is automatically propagated to resolved conflict'
416
git cat-file commit HEAD~1 >picked_msg &&
417
git cat-file commit HEAD~2 >unrelatedpick_msg &&
418
git cat-file commit HEAD~3 >initial_msg &&
419
- test_must_fail grep "Signed-off-by:" initial_msg &&
419
+ ! grep "Signed-off-by:" initial_msg &&
420
grep "Signed-off-by:" unrelatedpick_msg &&
421
- test_must_fail grep "Signed-off-by:" picked_msg &&
421
+ ! grep "Signed-off-by:" picked_msg &&
422
grep "Signed-off-by:" anotherpick_msg
423
'
424
t/t5504-fetch-receive-strict.sh
+1
-1
@@ -152,7 +152,7 @@ test_expect_success 'push with receive.fsck.missingEmail=warn' '
152
git --git-dir=dst/.git config --add \
153
receive.fsck.badDate warn &&
154
git push --porcelain dst bogus >act 2>&1 &&
155
- test_must_fail grep "missingEmail" act
155
+ ! grep "missingEmail" act
156
'
157
158
test_expect_success \
t/t5516-fetch-push.sh
+1
-1
@@ -1004,7 +1004,7 @@ test_expect_success 'push --porcelain' '
1004
test_expect_success 'push --porcelain bad url' '
1005
mk_empty testrepo &&
1006
test_must_fail git push >.git/bar --porcelain asdfasdfasd refs/heads/master:refs/remotes/origin/master &&
1007
- test_must_fail grep -q Done .git/bar
1007
+ ! grep -q Done .git/bar
1008
'
1009
1010
test_expect_success 'push --porcelain rejected' '
t/t5601-clone.sh
+1
-1
@@ -151,7 +151,7 @@ test_expect_success 'clone --mirror does not repeat tags' '
151
git clone --mirror src mirror2 &&
152
(cd mirror2 &&
153
git show-ref 2> clone.err > clone.out) &&
154
- test_must_fail grep Duplicate mirror2/clone.err &&
154
+ ! grep Duplicate mirror2/clone.err &&
155
grep some-tag mirror2/clone.out
156
157
'
t/t6030-bisect-porcelain.sh
+1
-1
@@ -407,7 +407,7 @@ test_expect_success 'good merge base when good and bad are siblings' '
407
test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
408
grep $HASH4 my_bisect_log.txt &&
409
git bisect good > my_bisect_log.txt &&
410
- test_must_fail grep "merge base must be tested" my_bisect_log.txt &&
410
+ ! grep "merge base must be tested" my_bisect_log.txt &&
411
grep $HASH6 my_bisect_log.txt &&
412
git bisect reset
413
'
t/t7610-mergetool.sh
+1
-1
@@ -601,7 +601,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT
601
test_config mergetool.myecho.trustExitCode true &&
602
test_must_fail git merge master &&
603
git mergetool --no-prompt --tool myecho -- both >actual &&
604
- test_must_fail grep ^\./both_LOCAL_ actual >/dev/null &&
604
+ ! grep ^\./both_LOCAL_ actual >/dev/null &&
605
grep /both_LOCAL_ actual >/dev/null &&
606
git reset --hard master >/dev/null 2>&1
607
'
t/t9001-send-email.sh
+1
-1
@@ -50,7 +50,7 @@ test_no_confirm () {
50
--smtp-server="$(pwd)/fake.sendmail" \
51
$@ \
52
$patches >stdout &&
53
- test_must_fail grep "Send this email" stdout &&
53
+ ! grep "Send this email" stdout &&
54
>no_confirm_okay
55
}
56
t/t9117-git-svn-init-clone.sh
+6
-6
@@ -55,7 +55,7 @@ test_expect_success 'clone to target directory with --stdlayout' '
55
test_expect_success 'init without -s/-T/-b/-t does not warn' '
56
test ! -d trunk &&
57
git svn init "$svnrepo"/project/trunk trunk 2>warning &&
58
- test_must_fail grep -q prefix warning &&
58
+ ! grep -q prefix warning &&
59
rm -rf trunk &&
60
rm -f warning
61
'
@@ -63,7 +63,7 @@ test_expect_success 'init without -s/-T/-b/-t does not warn' '
63
test_expect_success 'clone without -s/-T/-b/-t does not warn' '
64
test ! -d trunk &&
65
git svn clone "$svnrepo"/project/trunk 2>warning &&
66
- test_must_fail grep -q prefix warning &&
66
+ ! grep -q prefix warning &&
67
rm -rf trunk &&
68
rm -f warning
69
'
@@ -86,7 +86,7 @@ EOF
86
test_expect_success 'init with -s/-T/-b/-t assumes --prefix=origin/' '
87
test ! -d project &&
88
git svn init -s "$svnrepo"/project project 2>warning &&
89
- test_must_fail grep -q prefix warning &&
89
+ ! grep -q prefix warning &&
90
test_svn_configured_prefix "origin/" &&
91
rm -rf project &&
92
rm -f warning
@@ -95,7 +95,7 @@ test_expect_success 'init with -s/-T/-b/-t assumes --prefix=origin/' '
95
test_expect_success 'clone with -s/-T/-b/-t assumes --prefix=origin/' '
96
test ! -d project &&
97
git svn clone -s "$svnrepo"/project 2>warning &&
98
- test_must_fail grep -q prefix warning &&
98
+ ! grep -q prefix warning &&
99
test_svn_configured_prefix "origin/" &&
100
rm -rf project &&
101
rm -f warning
@@ -104,7 +104,7 @@ test_expect_success 'clone with -s/-T/-b/-t assumes --prefix=origin/' '
104
test_expect_success 'init with -s/-T/-b/-t and --prefix "" still works' '
105
test ! -d project &&
106
git svn init -s "$svnrepo"/project project --prefix "" 2>warning &&
107
- test_must_fail grep -q prefix warning &&
107
+ ! grep -q prefix warning &&
108
test_svn_configured_prefix "" &&
109
rm -rf project &&
110
rm -f warning
@@ -113,7 +113,7 @@ test_expect_success 'init with -s/-T/-b/-t and --prefix "" still works' '
113
test_expect_success 'clone with -s/-T/-b/-t and --prefix "" still works' '
114
test ! -d project &&
115
git svn clone -s "$svnrepo"/project --prefix "" 2>warning &&
116
- test_must_fail grep -q prefix warning &&
116
+ ! grep -q prefix warning &&
117
test_svn_configured_prefix "" &&
118
rm -rf project &&
119
rm -f warning
t/t9813-git-p4-preserve-users.sh
+4
-4
@@ -126,13 +126,13 @@ test_expect_success 'not preserving user with mixed authorship' '
126
grep "git author charlie@example.com does not match" &&
127
128
make_change_by_user usernamefile3 alice alice@example.com &&
129
- git p4 commit |\
130
- test_must_fail grep "git author.*does not match" &&
129
+ git p4 commit >actual &&
130
+ ! 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 |\
135
- test_must_fail grep "git author.*does not match" &&
134
+ git p4 commit >actual &&
135
+ ! grep "git author.*does not match" actual &&
136
137
p4_check_commit_author usernamefile3 alice
138
)
t/t9814-git-p4-rename.sh
+3
-3
@@ -141,7 +141,7 @@ test_expect_success 'detect copies' '
141
git diff-tree -r -C HEAD &&
142
git p4 submit &&
143
p4 filelog //depot/file8 &&
144
- p4 filelog //depot/file8 | test_must_fail grep -q "branch from" &&
144
+ ! p4 filelog //depot/file8 | grep -q "branch from" &&
145
146
echo "file9" >>file2 &&
147
git commit -a -m "Differentiate file2" &&
@@ -154,7 +154,7 @@ test_expect_success 'detect copies' '
154
git config git-p4.detectCopies true &&
155
git p4 submit &&
156
p4 filelog //depot/file9 &&
157
- p4 filelog //depot/file9 | test_must_fail grep -q "branch from" &&
157
+ ! p4 filelog //depot/file9 | grep -q "branch from" &&
158
159
echo "file10" >>file2 &&
160
git commit -a -m "Differentiate file2" &&
@@ -202,7 +202,7 @@ test_expect_success 'detect copies' '
202
git config git-p4.detectCopies $(($level + 2)) &&
203
git p4 submit &&
204
p4 filelog //depot/file12 &&
205
- p4 filelog //depot/file12 | test_must_fail grep -q "branch from" &&
205
+ ! p4 filelog //depot/file12 | grep -q "branch from" &&
206
207
echo "file13" >>file2 &&
208
git commit -a -m "Differentiate file2" &&