mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
1fdd31cf52
Fix a memory leak that's been with us since this code was introduced in [1]. Later in [2] we started using FLEX_ALLOC_MEM() to allocate the "struct command *". 1.575f497456
(Add first cut at "git-receive-pack", 2005-06-29) 2.eb1af2df0b
(git-receive-pack: start parsing ref update commands, 2005-06-29) Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
46 lines
763 B
Bash
Executable file
46 lines
763 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='forced push to replace commit we do not have'
|
|
|
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
|
|
>file1 && git add file1 && test_tick &&
|
|
git commit -m Initial &&
|
|
git config receive.denyCurrentBranch warn &&
|
|
|
|
mkdir another && (
|
|
cd another &&
|
|
git init &&
|
|
git fetch --update-head-ok .. main:main
|
|
) &&
|
|
|
|
>file2 && git add file2 && test_tick &&
|
|
git commit -m Second
|
|
|
|
'
|
|
|
|
test_expect_success 'non forced push should die not segfault' '
|
|
|
|
(
|
|
cd another &&
|
|
test_must_fail git push .. main:main
|
|
)
|
|
|
|
'
|
|
|
|
test_expect_success 'forced push should succeed' '
|
|
|
|
(
|
|
cd another &&
|
|
git push .. +main:main
|
|
)
|
|
|
|
'
|
|
|
|
test_done
|