diff options
author | Christian Couder <chriscool@tuxfamily.org> | 2010-05-26 04:50:12 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-06-06 15:14:27 -0700 |
commit | 296c6bb21a6980f6e5b42f0790d6365c1e3f696f (patch) | |
tree | ee5833c88e3945984a5e87f5c428c5571c0efc8c /t/t4015-diff-whitespace.sh | |
parent | dfea79004c54bc96143386d6ac22de500ba4f747 (diff) | |
download | git-296c6bb21a6980f6e5b42f0790d6365c1e3f696f.tar.gz |
diff: fix "git show -C -C" output when renaming a binary file
A bug was introduced in 3e97c7c6af2901cec63bf35fcd43ae3472e24af8
(No diff -b/-w output for all-whitespace changes, Nov 19 2009)
that made the lines:
diff --git a/bar b/sub/bar
similarity index 100%
rename from bar
rename to sub/bar
disappear from "git show -C -C" output when file bar is a binary
file.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4015-diff-whitespace.sh')
-rwxr-xr-x | t/t4015-diff-whitespace.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index 90f3342373..7e78851a11 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -396,6 +396,43 @@ test_expect_success 'whitespace-only changes not reported' ' test_cmp expect actual ' +cat <<EOF >expect +diff --git a/x b/z +similarity index NUM% +rename from x +rename to z +index 380c32a..a97b785 100644 +EOF +test_expect_success 'whitespace-only changes reported across renames' ' + git reset --hard && + for i in 1 2 3 4 5 6 7 8 9; do echo "$i$i$i$i$i$i"; done >x && + git add x && + git commit -m "base" && + sed -e "5s/^/ /" x >z && + git rm x && + git add z && + git diff -w -M --cached | + sed -e "/^similarity index /s/[0-9][0-9]*/NUM/" >actual && + test_cmp expect actual +' + +cat >expected <<\EOF +diff --git a/empty b/void +similarity index 100% +rename from empty +rename to void +EOF + +test_expect_success 'rename empty' ' + git reset --hard && + >empty && + git add empty && + git commit -m empty && + git mv empty void && + git diff -w --cached -M >current && + test_cmp expected current +' + test_expect_success 'combined diff with autocrlf conversion' ' git reset --hard && |