mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
![Junio C Hamano](/assets/img/avatar_default.png)
Broken &&-chains in the test scripts have been corrected. * es/test-chain-lint: t6000-t9999: detect and signal failure within loop t5000-t5999: detect and signal failure within loop t4000-t4999: detect and signal failure within loop t0000-t3999: detect and signal failure within loop tests: simplify by dropping unnecessary `for` loops tests: apply modern idiom for exiting loop upon failure tests: apply modern idiom for signaling test failure tests: fix broken &&-chains in `{...}` groups tests: fix broken &&-chains in `$(...)` command substitutions tests: fix broken &&-chains in compound statements tests: use test_write_lines() to generate line-oriented output tests: simplify construction of large blocks of text t9107: use shell parameter expansion to avoid breaking &&-chain t6300: make `%(raw:size) --shell` test more robust t5516: drop unnecessary subshell and command invocation t4202: clarify intent by creating expected content less cleverly t1020: avoid aborting entire test script when one test fails t1010: fix unnoticed failure on Windows t/lib-pager: use sane_unset() to avoid breaking &&-chain
71 lines
1.3 KiB
Bash
Executable file
71 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
# Copyright (c) 2011, Google Inc.
|
|
|
|
test_description='diff --stat-count'
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./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 || return 1
|
|
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
|