1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-27 08:46:18 +02:00
git/t/t5405-send-pack-rewind.sh
Ævar Arnfjörð Bjarmason 1fdd31cf52 receive-pack: release the linked "struct command *" list
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>
2023-02-06 15:34:40 -08:00

47 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