Skip to content

Commit f6041ab

Browse files
Denton-Lgitster
authored andcommitted
t0020: don't use test_must_fail has_cr
The test_must_fail function should only be used for git commands since we should assume that external commands work sanely. Since has_cr() just wraps a tr and grep pipeline, replace `test_must_fail has_cr` with `! has_cr`. Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f46c243 commit f6041ab

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

t/t0020-crlf.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ test_expect_success 'checkout with autocrlf=input' '
159159
rm -f tmp one dir/two three &&
160160
git config core.autocrlf input &&
161161
git read-tree --reset -u HEAD &&
162-
test_must_fail has_cr one &&
163-
test_must_fail has_cr dir/two &&
162+
! has_cr one &&
163+
! has_cr dir/two &&
164164
git update-index -- one dir/two &&
165165
test "$one" = $(git hash-object --stdin <one) &&
166166
test "$two" = $(git hash-object --stdin <dir/two) &&
@@ -237,9 +237,9 @@ test_expect_success '.gitattributes says two is binary' '
237237
git config core.autocrlf true &&
238238
git read-tree --reset -u HEAD &&
239239
240-
test_must_fail has_cr dir/two &&
240+
! has_cr dir/two &&
241241
verbose has_cr one &&
242-
test_must_fail has_cr three
242+
! has_cr three
243243
'
244244

245245
test_expect_success '.gitattributes says two is input' '
@@ -248,7 +248,7 @@ test_expect_success '.gitattributes says two is input' '
248248
echo "two crlf=input" >.gitattributes &&
249249
git read-tree --reset -u HEAD &&
250250
251-
test_must_fail has_cr dir/two
251+
! has_cr dir/two
252252
'
253253

254254
test_expect_success '.gitattributes says two and three are text' '
@@ -270,7 +270,7 @@ test_expect_success 'in-tree .gitattributes (1)' '
270270
rm -rf tmp one dir .gitattributes patch.file three &&
271271
git read-tree --reset -u HEAD &&
272272
273-
test_must_fail has_cr one &&
273+
! has_cr one &&
274274
verbose has_cr three
275275
'
276276

@@ -280,7 +280,7 @@ test_expect_success 'in-tree .gitattributes (2)' '
280280
git read-tree --reset HEAD &&
281281
git checkout-index -f -q -u -a &&
282282
283-
test_must_fail has_cr one &&
283+
! has_cr one &&
284284
verbose has_cr three
285285
'
286286

@@ -291,7 +291,7 @@ test_expect_success 'in-tree .gitattributes (3)' '
291291
git checkout-index -u .gitattributes &&
292292
git checkout-index -u one dir/two three &&
293293
294-
test_must_fail has_cr one &&
294+
! has_cr one &&
295295
verbose has_cr three
296296
'
297297

@@ -302,7 +302,7 @@ test_expect_success 'in-tree .gitattributes (4)' '
302302
git checkout-index -u one dir/two three &&
303303
git checkout-index -u .gitattributes &&
304304
305-
test_must_fail has_cr one &&
305+
! has_cr one &&
306306
verbose has_cr three
307307
'
308308

0 commit comments

Comments
 (0)