mirror of
https://github.com/git/git
synced 2024-08-23 18:00:25 +00:00
![Ævar Arnfjörð Bjarmason](/assets/img/avatar_default.png)
Clear the "boundary_commits" object_array in release_revisions(). This makes a few more tests pass under SANITIZE=leak, including "t/t4126-apply-empty.sh" which started failed as an UNLEAK() in cmd_format_patch() was removed in a preceding commit. This also re-marks the various tests relying on "git format-patch" as passing under "SANITIZE=leak", in the preceding "revisions API users: use release_revisions() in builtin/log.c" commit those were marked as failing as we removed the UNLEAK(rev) from cmd_format_patch() in "builtin/log.c". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
70 lines
1.6 KiB
Bash
Executable file
70 lines
1.6 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='apply empty'
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
>empty &&
|
|
git add empty &&
|
|
test_tick &&
|
|
git commit -m initial &&
|
|
git commit --allow-empty -m "empty commit" &&
|
|
git format-patch --always HEAD~ >empty.patch &&
|
|
test_write_lines a b c d e >empty &&
|
|
cat empty >expect &&
|
|
git diff |
|
|
sed -e "/^diff --git/d" \
|
|
-e "/^index /d" \
|
|
-e "s|a/empty|empty.orig|" \
|
|
-e "s|b/empty|empty|" >patch0 &&
|
|
sed -e "s|empty|missing|" patch0 >patch1 &&
|
|
>empty &&
|
|
git update-index --refresh
|
|
'
|
|
|
|
test_expect_success 'apply empty' '
|
|
rm -f missing &&
|
|
test_when_finished "git reset --hard" &&
|
|
git apply patch0 &&
|
|
test_cmp expect empty
|
|
'
|
|
|
|
test_expect_success 'apply empty patch fails' '
|
|
test_when_finished "git reset --hard" &&
|
|
test_must_fail git apply empty.patch &&
|
|
test_must_fail git apply - </dev/null
|
|
'
|
|
|
|
test_expect_success 'apply with --allow-empty succeeds' '
|
|
test_when_finished "git reset --hard" &&
|
|
git apply --allow-empty empty.patch &&
|
|
git apply --allow-empty - </dev/null
|
|
'
|
|
|
|
test_expect_success 'apply --index empty' '
|
|
rm -f missing &&
|
|
test_when_finished "git reset --hard" &&
|
|
git apply --index patch0 &&
|
|
test_cmp expect empty &&
|
|
git diff --exit-code
|
|
'
|
|
|
|
test_expect_success 'apply create' '
|
|
rm -f missing &&
|
|
test_when_finished "git reset --hard" &&
|
|
git apply patch1 &&
|
|
test_cmp expect missing
|
|
'
|
|
|
|
test_expect_success 'apply --index create' '
|
|
rm -f missing &&
|
|
test_when_finished "git reset --hard" &&
|
|
git apply --index patch1 &&
|
|
test_cmp expect missing &&
|
|
git diff --exit-code
|
|
'
|
|
|
|
test_done
|