2007-09-06 08:58:40 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='apply a patch that is larger than the preimage'
|
|
|
|
|
2021-10-31 01:24:18 +03:00
|
|
|
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
2007-09-06 08:58:40 +04:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
cat >F <<\EOF
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
999999
|
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
|
|
|
D
|
|
|
|
E
|
|
|
|
F
|
|
|
|
G
|
|
|
|
H
|
|
|
|
I
|
|
|
|
J
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success setup '
|
|
|
|
|
|
|
|
git add F &&
|
|
|
|
mv F G &&
|
|
|
|
sed -e "s/1/11/" -e "s/999999/9/" -e "s/H/HH/" <G >F &&
|
|
|
|
git diff >patch &&
|
|
|
|
sed -e "/^\$/d" <G >F &&
|
|
|
|
git add F
|
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'apply should fail gracefully' '
|
|
|
|
|
|
|
|
if git apply --index patch
|
|
|
|
then
|
|
|
|
echo Oops, should not have succeeded
|
|
|
|
false
|
|
|
|
else
|
tests: fix broken &&-chains in compound statements
The top-level &&-chain checker built into t/test-lib.sh causes tests to
magically exit with code 117 if the &&-chain is broken. However, it has
the shortcoming that the magic does not work within `{...}` groups,
`(...)` subshells, `$(...)` substitutions, or within bodies of compound
statements, such as `if`, `for`, `while`, `case`, etc. `chainlint.sed`
partly fills in the gap by catching broken &&-chains in `(...)`
subshells, but bugs can still lurk behind broken &&-chains in the other
cases.
Fix broken &&-chains in compound statements in order to reduce the
number of possible lurking bugs.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-09 08:11:06 +03:00
|
|
|
status=$? &&
|
|
|
|
echo "Status was $status" &&
|
2007-09-06 08:58:40 +04:00
|
|
|
if test -f .git/index.lock
|
|
|
|
then
|
|
|
|
echo Oops, should not have crashed
|
|
|
|
false
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|