summaryrefslogtreecommitdiff
path: root/t/t4006-diff-mode.sh
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-05-01 17:10:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-05-01 18:02:12 (GMT)
commit4434e6ba6c2de994bd28892abe9fb3bdf1641560 (patch)
tree67cc275a033e9e5716a5ec4a13b993e76e76db40 /t/t4006-diff-mode.sh
parentec57a821a3bacdaaaf5eeba55a124bf1a502a13f (diff)
downloadgit-4434e6ba6c2de994bd28892abe9fb3bdf1641560.zip
git-4434e6ba6c2de994bd28892abe9fb3bdf1641560.tar.gz
git-4434e6ba6c2de994bd28892abe9fb3bdf1641560.tar.bz2
tests: check --[short]stat output after chmod
Add a test to check 'diff --stat' output with a text file after chmod, and the same for a binary file. This demonstrates that text and binary files are treated differently, which can be misleading. While at it, add tests to check --shortstat output, too. Reported-by: Martin Mareš <mj@ucw.cz> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4006-diff-mode.sh')
-rwxr-xr-xt/t4006-diff-mode.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh
index b85f622..392dfef 100755
--- a/t/t4006-diff-mode.sh
+++ b/t/t4006-diff-mode.sh
@@ -25,4 +25,41 @@ test_expect_success 'chmod' '
test_cmp expected check
'
+test_expect_success 'prepare binary file' '
+ git commit -m rezrov &&
+ dd if=/dev/zero of=binbin bs=1024 count=1 &&
+ git add binbin &&
+ git commit -m binbin
+'
+
+test_expect_success '--stat output after text chmod' '
+ test_chmod -x rezrov &&
+ echo " 0 files changed" >expect &&
+ git diff HEAD --stat >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '--shortstat output after text chmod' '
+ git diff HEAD --shortstat >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '--stat output after binary chmod' '
+ test_chmod +x binbin &&
+ cat >expect <<-EOF &&
+ binbin | Bin 1024 -> 1024 bytes
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ EOF
+ git diff HEAD --stat >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '--shortstat output after binary chmod' '
+ cat >expect <<-EOF &&
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ EOF
+ git diff HEAD --shortstat >actual &&
+ test_cmp expect actual
+'
+
test_done