1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-31 22:37:54 +01:00
git/t/t4049-diff-stat-count.sh
Jeff King 99094a7ad4 t: fix trivial &&-chain breakage
These are tests which are missing a link in their &&-chain,
but during a setup phase. We may fail to notice failure in
commands that build the test environment, but these are
typically not expected to fail at all (but it's still good
to double-check that our test environment is what we
expect).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-03-20 10:20:14 -07:00

68 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_i18ncmp 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_i18ncmp 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_i18ncmp expect actual
'
test_done