bash completion: complete variable names for "git config" with options
[gitweb.git] / t / t4020-diff-external.sh
index 281680d95afacb291d56d9d7f23efed1f3169e93..0720001281db6aeb5a3b6bb46cd6914ad7d78d33 100755 (executable)
@@ -136,4 +136,28 @@ test_expect_success 'GIT_EXTERNAL_DIFF with more than one changed files' '
        GIT_EXTERNAL_DIFF=echo git diff
 '
 
+echo "#!$SHELL_PATH" >fake-diff.sh
+cat >> fake-diff.sh <<\EOF
+cat $2 >> crlfed.txt
+EOF
+chmod a+x fake-diff.sh
+
+keep_only_cr () {
+       tr -dc '\015'
+}
+
+test_expect_success 'external diff with autocrlf = true' '
+       git config core.autocrlf true &&
+       GIT_EXTERNAL_DIFF=./fake-diff.sh git diff &&
+       test $(wc -l < crlfed.txt) = $(cat crlfed.txt | keep_only_cr | wc -c)
+'
+
+test_expect_success 'diff --cached' '
+       git add file &&
+       git update-index --assume-unchanged file &&
+       echo second >file &&
+       git diff --cached >actual &&
+       test_cmp ../t4020/diff.NUL actual
+'
+
 test_done