From: Junio C Hamano Date: Sat, 28 Mar 2009 07:42:31 +0000 (-0700) Subject: Merge branch 'jc/maint-1.6.0-diff-borrow-carefully' X-Git-Tag: v1.6.3-rc0~72 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=aa72a14a7f648ae47749281002e94cfcf36f39e2;p=git.git Merge branch 'jc/maint-1.6.0-diff-borrow-carefully' * jc/maint-1.6.0-diff-borrow-carefully: diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged --- aa72a14a7f648ae47749281002e94cfcf36f39e2 diff --cc t/t4020-diff-external.sh index f8c99f1a9,f853b8a89..072000128 --- a/t/t4020-diff-external.sh +++ b/t/t4020-diff-external.sh @@@ -125,31 -104,15 +125,39 @@@ echo NULZbetweenZwords | perl -pe 'y/Z/ test_expect_success 'force diff with "diff"' ' echo >.gitattributes "file diff" && git diff >actual && - test_cmp ../t4020/diff.NUL actual + test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual +' + +test_expect_success 'GIT_EXTERNAL_DIFF with more than one changed files' ' + echo anotherfile > file2 && + git add file2 && + git commit -m "added 2nd file" && + echo modified >file2 && + 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