aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-11-27 12:55:00 -0800
committerJunio C Hamano <gitster@pobox.com>2012-11-27 13:21:15 -0800
commit9667ccbc8c513458cba0606644150eccb8a0c86b (patch)
tree14fb2767d9e2f2cdc68423d9fb3e9c7d419293f5
parent74faaa16f016af9fc429770ba701f2aa598d9f21 (diff)
downloadgit-9667ccbc8c513458cba0606644150eccb8a0c86b.tar.gz
git-9667ccbc8c513458cba0606644150eccb8a0c86b.tar.xz
test: add failing tests for "diff --stat" to t4049
There are a few problems in diff.c around --stat area, partially caused by the recent 74faaa1 (Fix "git diff --stat" for interesting - but empty - file changes, 2012-10-17), and largely caused by the earlier change that introduced when --stat-count was added. Add a few test pieces to t4049 to expose the issues. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t4049-diff-stat-count.sh46
1 files changed, 45 insertions, 1 deletions
diff --git a/t/t4049-diff-stat-count.sh b/t/t4049-diff-stat-count.sh
index 7b3ef0053..e212b1186 100755
--- a/t/t4049-diff-stat-count.sh
+++ b/t/t4049-diff-stat-count.sh
@@ -4,12 +4,17 @@
test_description='diff --stat-count'
. ./test-lib.sh
-test_expect_success setup '
+test_expect_success 'setup' '
>a &&
>b &&
>c &&
>d &&
git add a b c d &&
+ git commit -m initial
+'
+
+test_expect_success 'limit output to 2 (simple)' '
+ git reset --hard &&
chmod +x c d &&
echo a >a &&
echo b >b &&
@@ -23,4 +28,43 @@ test_expect_success setup '
test_i18ncmp expect actual
'
+test_expect_failure 'binary changes do not count in lines' '
+ git reset --hard &&
+ chmod +x c d &&
+ echo a >a &&
+ echo b >b &&
+ cat "$TEST_DIRECTORY"/test-binary-1.png >d &&
+ cat >expect <<-\EOF
+ a | 1 +
+ b | 1 +
+ ...
+ 4 files changed, 2 insertions(+)
+ EOF
+ git diff --stat --stat-count=2 >actual &&
+ test_i18ncmp expect actual
+'
+
+test_expect_failure 'exclude unmerged entries from total file count' '
+ git reset --hard &&
+ echo a >a &&
+ echo b >b &&
+ git ls-files -s a >x &&
+ git rm -f d &&
+ for stage in 1 2 3
+ do
+ sed -e "s/ 0 a/ $stage d/" x
+ done |
+ git update-index --index-info &&
+ echo d >d &&
+ chmod +x c d &&
+ cat >expect <<-\EOF
+ a | 1 +
+ b | 1 +
+ ...
+ 4 files changed, 3 insertions(+)
+ EOF
+ git diff --stat --stat-count=2 >actual &&
+ test_i18ncmp expect actual
+'
+
test_done