From 4e218f54b3de6aa8ef7d15020c4507031a519f7d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 21 Mar 2009 12:42:52 +0100 Subject: Smudge the files fed to external diff and textconv When preparing temporary files for an external diff or textconv, it is easier on the external tools, especially when they are implemented using platform tools, if they are fed the input after convert_to_working_tree(). This fixes msysGit issue 177. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t4020-diff-external.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't/t4020-diff-external.sh') diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh index 281680d95a..f8c99f1a98 100755 --- a/t/t4020-diff-external.sh +++ b/t/t4020-diff-external.sh @@ -136,4 +136,20 @@ 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_done -- cgit v1.2.3 From 150115aded2e1e0a83db7366f59e4b5bf1aa8135 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 22 Mar 2009 15:26:07 -0700 Subject: diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged When the index says that the file in the work tree that corresponds to the blob object that is used for comparison is known to be unchanged, "diff" reads from the file and applies convert_to_git(), instead of inflating the object, to feed the internal diff engine with, because an earlier benchnark found that it tends to be faster to use this optimization. However, the index can lie when the path is marked as assume-unchanged. Disable the optimization for such paths. Signed-off-by: Junio C Hamano --- t/t4020-diff-external.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't/t4020-diff-external.sh') diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh index 637b4e19d5..f853b8a894 100755 --- a/t/t4020-diff-external.sh +++ b/t/t4020-diff-external.sh @@ -107,4 +107,12 @@ test_expect_success 'force diff with "diff"' ' test_cmp ../t4020/diff.NUL actual ' +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 -- cgit v1.2.3