1
0
mirror of https://github.com/git/git synced 2024-06-30 22:54:27 +00:00
git/t/t4137-apply-submodule.sh
Patrick Steinhardt cc395d6b47 checkout: clarify memory ownership in unique_tracking_name()
The function `unique_tracking_name()` returns an allocated string, but
does not clearly indicate this because its return type is `const char *`
instead of `char *`. This has led to various callsites where we never
free its returned memory at all, which causes memory leaks.

Plug those leaks and mark now-passing tests as leak free.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-27 11:19:58 -07:00

26 lines
514 B
Bash
Executable File

#!/bin/sh
test_description='git apply handling submodules'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
apply_index () {
git diff --ignore-submodules=dirty "..$1" >diff &&
may_only_be_test_must_fail "$2" &&
$2 git apply --index diff
}
test_submodule_switch_func "apply_index"
apply_3way () {
git diff --ignore-submodules=dirty "..$1" >diff &&
may_only_be_test_must_fail "$2" &&
$2 git apply --3way diff
}
test_submodule_switch_func "apply_3way"
test_done