]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4049-diff-stat-count.sh
diff --shortstat: do not count "unmerged" entries
[thirdparty/git.git] / t / t4049-diff-stat-count.sh
CommitLineData
e5f85df8
JH
1#!/bin/sh
2# Copyright (c) 2011, Google Inc.
3
4test_description='diff --stat-count'
5. ./test-lib.sh
6
9667ccbc 7test_expect_success 'setup' '
e5f85df8
JH
8 >a &&
9 >b &&
10 >c &&
11 >d &&
12 git add a b c d &&
9667ccbc
JH
13 git commit -m initial
14'
15
16test_expect_success 'limit output to 2 (simple)' '
17 git reset --hard &&
e5f85df8
JH
18 chmod +x c d &&
19 echo a >a &&
20 echo b >b &&
21 cat >expect <<-\EOF
dc801e71
ZJS
22 a | 1 +
23 b | 1 +
74faaa16
LT
24 ...
25 4 files changed, 2 insertions(+)
e5f85df8
JH
26 EOF
27 git diff --stat --stat-count=2 >actual &&
fc5877a6 28 test_i18ncmp expect actual
e5f85df8
JH
29'
30
a20d3c0d 31test_expect_success 'binary changes do not count in lines' '
9667ccbc
JH
32 git reset --hard &&
33 chmod +x c d &&
34 echo a >a &&
35 echo b >b &&
36 cat "$TEST_DIRECTORY"/test-binary-1.png >d &&
37 cat >expect <<-\EOF
38 a | 1 +
39 b | 1 +
40 ...
41 4 files changed, 2 insertions(+)
42 EOF
43 git diff --stat --stat-count=2 >actual &&
44 test_i18ncmp expect actual
45'
46
82dfc2c4 47test_expect_success 'exclude unmerged entries from total file count' '
9667ccbc
JH
48 git reset --hard &&
49 echo a >a &&
50 echo b >b &&
51 git ls-files -s a >x &&
52 git rm -f d &&
53 for stage in 1 2 3
54 do
55 sed -e "s/ 0 a/ $stage d/" x
56 done |
57 git update-index --index-info &&
58 echo d >d &&
59 chmod +x c d &&
60 cat >expect <<-\EOF
61 a | 1 +
62 b | 1 +
63 ...
64 4 files changed, 3 insertions(+)
65 EOF
66 git diff --stat --stat-count=2 >actual &&
67 test_i18ncmp expect actual
68'
69
e5f85df8 70test_done