Merge branch 'jk/ident-loosen-getpwuid' into maint
[git/gitweb.git] / t / t4049-diff-stat-count.sh
bloba34121740a4ab58e8abd16b3a00df5f44d2f1648
1 #!/bin/sh
2 # Copyright (c) 2011, Google Inc.
4 test_description='diff --stat-count'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 >a &&
9 >b &&
10 >c &&
11 >d &&
12 git add a b c d &&
13 git commit -m initial
16 test_expect_success 'mode-only change show as a 0-line change' '
17 git reset --hard &&
18 test_chmod +x b d &&
19 echo a >a &&
20 echo c >c &&
21 cat >expect <<-\EOF &&
22 a | 1 +
23 b | 0
24 ...
25 4 files changed, 2 insertions(+)
26 EOF
27 git diff --stat --stat-count=2 HEAD >actual &&
28 test_i18ncmp expect actual
31 test_expect_success 'binary changes do not count in lines' '
32 git reset --hard &&
33 echo a >a &&
34 echo c >c &&
35 cat "$TEST_DIRECTORY"/test-binary-1.png >d &&
36 cat >expect <<-\EOF &&
37 a | 1 +
38 c | 1 +
39 ...
40 3 files changed, 2 insertions(+)
41 EOF
42 git diff --stat --stat-count=2 >actual &&
43 test_i18ncmp expect actual
46 test_expect_success 'exclude unmerged entries from total file count' '
47 git reset --hard &&
48 echo a >a &&
49 echo b >b &&
50 git ls-files -s a >x &&
51 git rm -f d &&
52 for stage in 1 2 3
54 sed -e "s/ 0 a/ $stage d/" x
55 done |
56 git update-index --index-info &&
57 echo d >d &&
58 cat >expect <<-\EOF &&
59 a | 1 +
60 b | 1 +
61 ...
62 3 files changed, 3 insertions(+)
63 EOF
64 git diff --stat --stat-count=2 >actual &&
65 test_i18ncmp expect actual
68 test_done