t4049: refocus tests
The primary thing Linus's patch wanted to change was to make sure that 0-line change appears for a mode-only change. Update the first test to chmod a file that we can see in the output (limited by --stat-count) to demonstrate it. Also make sure to use test_chmod and compare the index and the tree, so that we can run this test even on a filesystem without permission bits. Later two tests are about fixes to separate issues that were introduced and/or uncovered by Linus's patch as a side effect, but the issues are not related to mode-only changes. Remove chmod from the tests. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Nov 29, 2012 at 09:46 UTC
de9095955c581a664d9ce568a1ae58a98484090e
1 file changed
+9
-11
t/t4049-diff-stat-count.sh
+9
-11
@@ -13,32 +13,31 @@ test_expect_success 'setup' '
13
git commit -m initial
14
'
15
16
-test_expect_success 'limit output to 2 (simple)' '
16
+test_expect_success 'mode-only change show as a 0-line change' '
17
git reset --hard &&
18
- chmod +x c d &&
18
+ test_chmod +x b d &&
19
echo a >a &&
20
- echo b >b &&
20
+ echo c >c &&
21
cat >expect <<-\EOF
22
a | 1 +
23
- b | 1 +
23
+ b | 0
24
...
25
4 files changed, 2 insertions(+)
26
EOF
27
- git diff --stat --stat-count=2 >actual &&
27
+ git diff --stat --stat-count=2 HEAD >actual &&
28
test_i18ncmp expect actual
29
'
30
31
test_expect_success 'binary changes do not count in lines' '
32
git reset --hard &&
33
- chmod +x c d &&
33
echo a >a &&
35
- echo b >b &&
34
+ echo c >c &&
35
cat "$TEST_DIRECTORY"/test-binary-1.png >d &&
36
cat >expect <<-\EOF
37
a | 1 +
39
- b | 1 +
38
+ c | 1 +
39
...
41
- 4 files changed, 2 insertions(+)
40
+ 3 files changed, 2 insertions(+)
41
EOF
42
git diff --stat --stat-count=2 >actual &&
43
test_i18ncmp expect actual
@@ -56,12 +55,11 @@ test_expect_success 'exclude unmerged entries from total file count' '
55
done |
56
git update-index --index-info &&
57
echo d >d &&
59
- chmod +x c d &&
58
cat >expect <<-\EOF
59
a | 1 +
60
b | 1 +
61
...
64
- 4 files changed, 3 insertions(+)
62
+ 3 files changed, 3 insertions(+)
63
EOF
64
git diff --stat --stat-count=2 >actual &&
65
test_i18ncmp expect actual