1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-19 23:26:13 +02:00
git/t/t4049-diff-stat-count.sh
Ævar Arnfjörð Bjarmason 1108cea7f8 tests: remove most uses of test_i18ncmp
As a follow-up to d162b25f95 (tests: remove support for
GIT_TEST_GETTEXT_POISON, 2021-01-20) remove most uses of test_i18ncmp
via a simple s/test_i18ncmp/test_cmp/g search-replacement.

I'm leaving t6300-for-each-ref.sh out due to a conflict with in-flight
changes between "master" and "seen", as well as the prerequisite
itself due to other changes between "master" and "next/seen" which add
new test_i18ncmp uses.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-02-10 23:48:27 -08:00

69 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Copyright (c) 2011, Google Inc.
test_description='diff --stat-count'
. ./test-lib.sh
test_expect_success 'setup' '
>a &&
>b &&
>c &&
>d &&
git add a b c d &&
git commit -m initial
'
test_expect_success 'mode-only change show as a 0-line change' '
git reset --hard &&
test_chmod +x b d &&
echo a >a &&
echo c >c &&
cat >expect <<-\EOF &&
a | 1 +
b | 0
...
4 files changed, 2 insertions(+)
EOF
git diff --stat --stat-count=2 HEAD >actual &&
test_cmp expect actual
'
test_expect_success 'binary changes do not count in lines' '
git reset --hard &&
echo a >a &&
echo c >c &&
cat "$TEST_DIRECTORY"/test-binary-1.png >d &&
cat >expect <<-\EOF &&
a | 1 +
c | 1 +
...
3 files changed, 2 insertions(+)
EOF
git diff --stat --stat-count=2 >actual &&
test_cmp expect actual
'
test_expect_success '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 &&
cat >expect <<-\EOF &&
a | 1 +
b | 1 +
...
3 files changed, 3 insertions(+)
EOF
git diff --stat --stat-count=2 >actual &&
test_cmp expect actual
'
test_done