Skip to content

Commit de90959

Browse files
committed
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 <[email protected]>
1 parent 20c8cde commit de90959

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

t/t4049-diff-stat-count.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,31 @@ test_expect_success 'setup' '
1313
git commit -m initial
1414
'
1515

16-
test_expect_success 'limit output to 2 (simple)' '
16+
test_expect_success 'mode-only change show as a 0-line change' '
1717
git reset --hard &&
18-
chmod +x c d &&
18+
test_chmod +x b d &&
1919
echo a >a &&
20-
echo b >b &&
20+
echo c >c &&
2121
cat >expect <<-\EOF
2222
a | 1 +
23-
b | 1 +
23+
b | 0
2424
...
2525
4 files changed, 2 insertions(+)
2626
EOF
27-
git diff --stat --stat-count=2 >actual &&
27+
git diff --stat --stat-count=2 HEAD >actual &&
2828
test_i18ncmp expect actual
2929
'
3030

3131
test_expect_success 'binary changes do not count in lines' '
3232
git reset --hard &&
33-
chmod +x c d &&
3433
echo a >a &&
35-
echo b >b &&
34+
echo c >c &&
3635
cat "$TEST_DIRECTORY"/test-binary-1.png >d &&
3736
cat >expect <<-\EOF
3837
a | 1 +
39-
b | 1 +
38+
c | 1 +
4039
...
41-
4 files changed, 2 insertions(+)
40+
3 files changed, 2 insertions(+)
4241
EOF
4342
git diff --stat --stat-count=2 >actual &&
4443
test_i18ncmp expect actual
@@ -56,12 +55,11 @@ test_expect_success 'exclude unmerged entries from total file count' '
5655
done |
5756
git update-index --index-info &&
5857
echo d >d &&
59-
chmod +x c d &&
6058
cat >expect <<-\EOF
6159
a | 1 +
6260
b | 1 +
6361
...
64-
4 files changed, 3 insertions(+)
62+
3 files changed, 3 insertions(+)
6563
EOF
6664
git diff --stat --stat-count=2 >actual &&
6765
test_i18ncmp expect actual

0 commit comments

Comments
 (0)