Skip to content

Commit

Permalink
t0020: don't use test_must_fail has_cr
Browse files Browse the repository at this point in the history
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 <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Denton-L authored and gitster committed Dec 20, 2019
1 parent f46c243 commit f6041ab
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions t/t0020-crlf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ test_expect_success 'checkout with autocrlf=input' '
rm -f tmp one dir/two three &&
git config core.autocrlf input &&
git read-tree --reset -u HEAD &&
test_must_fail has_cr one &&
test_must_fail has_cr dir/two &&
! has_cr one &&
! has_cr dir/two &&
git update-index -- one dir/two &&
test "$one" = $(git hash-object --stdin <one) &&
test "$two" = $(git hash-object --stdin <dir/two) &&
Expand Down Expand Up @@ -237,9 +237,9 @@ test_expect_success '.gitattributes says two is binary' '
git config core.autocrlf true &&
git read-tree --reset -u HEAD &&
test_must_fail has_cr dir/two &&
! has_cr dir/two &&
verbose has_cr one &&
test_must_fail has_cr three
! has_cr three
'

test_expect_success '.gitattributes says two is input' '
Expand All @@ -248,7 +248,7 @@ test_expect_success '.gitattributes says two is input' '
echo "two crlf=input" >.gitattributes &&
git read-tree --reset -u HEAD &&
test_must_fail has_cr dir/two
! has_cr dir/two
'

test_expect_success '.gitattributes says two and three are text' '
Expand All @@ -270,7 +270,7 @@ test_expect_success 'in-tree .gitattributes (1)' '
rm -rf tmp one dir .gitattributes patch.file three &&
git read-tree --reset -u HEAD &&
test_must_fail has_cr one &&
! has_cr one &&
verbose has_cr three
'

Expand All @@ -280,7 +280,7 @@ test_expect_success 'in-tree .gitattributes (2)' '
git read-tree --reset HEAD &&
git checkout-index -f -q -u -a &&
test_must_fail has_cr one &&
! has_cr one &&
verbose has_cr three
'

Expand All @@ -291,7 +291,7 @@ test_expect_success 'in-tree .gitattributes (3)' '
git checkout-index -u .gitattributes &&
git checkout-index -u one dir/two three &&
test_must_fail has_cr one &&
! has_cr one &&
verbose has_cr three
'

Expand All @@ -302,7 +302,7 @@ test_expect_success 'in-tree .gitattributes (4)' '
git checkout-index -u one dir/two three &&
git checkout-index -u .gitattributes &&
test_must_fail has_cr one &&
! has_cr one &&
verbose has_cr three
'

Expand Down

0 comments on commit f6041ab

Please sign in to comment.