diff options
Diffstat (limited to 't/t0020-crlf.sh')
-rwxr-xr-x | t/t0020-crlf.sh | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh index 1a8f44c44c..d2e51a81bc 100755 --- a/t/t0020-crlf.sh +++ b/t/t0020-crlf.sh @@ -20,14 +20,14 @@ test_expect_success setup ' git commit -m initial && - one=`git rev-parse HEAD:one` && - dir=`git rev-parse HEAD:dir` && - two=`git rev-parse HEAD:dir/two` && - three=`git rev-parse HEAD:three` && + one=$(git rev-parse HEAD:one) && + dir=$(git rev-parse HEAD:dir) && + two=$(git rev-parse HEAD:dir/two) && + three=$(git rev-parse HEAD:three) && for w in Some extra lines here; do echo $w; done >>one && git diff >patch.file && - patched=`git hash-object --stdin <one` && + patched=$(git hash-object --stdin <one) && git read-tree --reset -u HEAD && echo happy. @@ -81,6 +81,14 @@ test_expect_success 'safecrlf: print warning only once' ' test $(git add doublewarn 2>&1 | grep "CRLF will be replaced by LF" | wc -l) = 1 ' + +test_expect_success 'safecrlf: git diff demotes safecrlf=true to warn' ' + git config core.autocrlf input && + git config core.safecrlf true && + git diff HEAD +' + + test_expect_success 'switch off autocrlf, safecrlf, reset HEAD' ' git config core.autocrlf false && git config core.safecrlf false && @@ -103,7 +111,7 @@ test_expect_success 'update with autocrlf=input' ' } done && - differs=`git diff-index --cached HEAD` && + differs=$(git diff-index --cached HEAD) && test -z "$differs" || { echo Oops "$differs" false @@ -127,7 +135,7 @@ test_expect_success 'update with autocrlf=true' ' } done && - differs=`git diff-index --cached HEAD` && + differs=$(git diff-index --cached HEAD) && test -z "$differs" || { echo Oops "$differs" false @@ -150,9 +158,9 @@ test_expect_success 'checkout with autocrlf=true' ' break } done && - test "$one" = `git hash-object --stdin <one` && - test "$two" = `git hash-object --stdin <dir/two` && - differs=`git diff-index --cached HEAD` && + test "$one" = $(git hash-object --stdin <one) && + test "$two" = $(git hash-object --stdin <dir/two) && + differs=$(git diff-index --cached HEAD) && test -z "$differs" || { echo Oops "$differs" false @@ -176,9 +184,9 @@ test_expect_success 'checkout with autocrlf=input' ' git update-index -- $f fi done && - test "$one" = `git hash-object --stdin <one` && - test "$two" = `git hash-object --stdin <dir/two` && - differs=`git diff-index --cached HEAD` && + test "$one" = $(git hash-object --stdin <one) && + test "$two" = $(git hash-object --stdin <dir/two) && + differs=$(git diff-index --cached HEAD) && test -z "$differs" || { echo Oops "$differs" false @@ -192,7 +200,7 @@ test_expect_success 'apply patch (autocrlf=input)' ' git read-tree --reset -u HEAD && git apply patch.file && - test "$patched" = "`git hash-object --stdin <one`" || { + test "$patched" = "$(git hash-object --stdin <one)" || { echo "Eh? apply without index" false } @@ -205,7 +213,7 @@ test_expect_success 'apply patch --cached (autocrlf=input)' ' git read-tree --reset -u HEAD && git apply --cached patch.file && - test "$patched" = `git rev-parse :one` || { + test "$patched" = $(git rev-parse :one) || { echo "Eh? apply with --cached" false } @@ -218,8 +226,8 @@ test_expect_success 'apply patch --index (autocrlf=input)' ' git read-tree --reset -u HEAD && git apply --index patch.file && - test "$patched" = `git rev-parse :one` && - test "$patched" = `git hash-object --stdin <one` || { + test "$patched" = $(git rev-parse :one) && + test "$patched" = $(git hash-object --stdin <one) || { echo "Eh? apply with --index" false } @@ -232,7 +240,7 @@ test_expect_success 'apply patch (autocrlf=true)' ' git read-tree --reset -u HEAD && git apply patch.file && - test "$patched" = "`remove_cr <one | git hash-object --stdin`" || { + test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || { echo "Eh? apply without index" false } @@ -245,7 +253,7 @@ test_expect_success 'apply patch --cached (autocrlf=true)' ' git read-tree --reset -u HEAD && git apply --cached patch.file && - test "$patched" = `git rev-parse :one` || { + test "$patched" = $(git rev-parse :one) || { echo "Eh? apply without index" false } @@ -258,8 +266,8 @@ test_expect_success 'apply patch --index (autocrlf=true)' ' git read-tree --reset -u HEAD && git apply --index patch.file && - test "$patched" = `git rev-parse :one` && - test "$patched" = "`remove_cr <one | git hash-object --stdin`" || { + test "$patched" = $(git rev-parse :one) && + test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || { echo "Eh? apply with --index" false } |