4f4b18497a
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
90 lines
2.2 KiB
Bash
Executable File
90 lines
2.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='diff with unmerged index entries'
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
for i in 0 1 2 3
|
|
do
|
|
blob=$(echo $i | git hash-object --stdin) &&
|
|
eval "blob$i=$blob" &&
|
|
eval "m$i=\"100644 \$blob$i $i\"" || return 1
|
|
done &&
|
|
paths= &&
|
|
for b in o x
|
|
do
|
|
for o in o x
|
|
do
|
|
for t in o x
|
|
do
|
|
path="$b$o$t" &&
|
|
case "$path" in ooo) continue ;; esac &&
|
|
paths="$paths$path " &&
|
|
p=" $path" &&
|
|
case "$b" in x) echo "$m1$p" ;; esac &&
|
|
case "$o" in x) echo "$m2$p" ;; esac &&
|
|
case "$t" in x) echo "$m3$p" ;; esac ||
|
|
return 1
|
|
done
|
|
done
|
|
done >ls-files-s.expect &&
|
|
git update-index --index-info <ls-files-s.expect &&
|
|
git ls-files -s >ls-files-s.actual &&
|
|
test_cmp ls-files-s.expect ls-files-s.actual
|
|
'
|
|
|
|
test_expect_success 'diff-files -0' '
|
|
for path in $paths
|
|
do
|
|
>"$path" &&
|
|
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" || return 1
|
|
done >diff-files-0.expect &&
|
|
git diff-files -0 >diff-files-0.actual &&
|
|
test_cmp diff-files-0.expect diff-files-0.actual
|
|
'
|
|
|
|
test_expect_success 'diff-files -1' '
|
|
for path in $paths
|
|
do
|
|
>"$path" &&
|
|
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
|
|
case "$path" in
|
|
x??) echo ":100644 100644 $blob1 $ZERO_OID M $path"
|
|
esac || return 1
|
|
done >diff-files-1.expect &&
|
|
git diff-files -1 >diff-files-1.actual &&
|
|
test_cmp diff-files-1.expect diff-files-1.actual
|
|
'
|
|
|
|
test_expect_success 'diff-files -2' '
|
|
for path in $paths
|
|
do
|
|
>"$path" &&
|
|
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
|
|
case "$path" in
|
|
?x?) echo ":100644 100644 $blob2 $ZERO_OID M $path"
|
|
esac || return 1
|
|
done >diff-files-2.expect &&
|
|
git diff-files -2 >diff-files-2.actual &&
|
|
test_cmp diff-files-2.expect diff-files-2.actual &&
|
|
git diff-files >diff-files-default-2.actual &&
|
|
test_cmp diff-files-2.expect diff-files-default-2.actual
|
|
'
|
|
|
|
test_expect_success 'diff-files -3' '
|
|
for path in $paths
|
|
do
|
|
>"$path" &&
|
|
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
|
|
case "$path" in
|
|
??x) echo ":100644 100644 $blob3 $ZERO_OID M $path"
|
|
esac || return 1
|
|
done >diff-files-3.expect &&
|
|
git diff-files -3 >diff-files-3.actual &&
|
|
test_cmp diff-files-3.expect diff-files-3.actual
|
|
'
|
|
|
|
test_done
|