summaryrefslogtreecommitdiffstats
path: root/t/t6426-merge-skip-unneeded-updates.sh
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-05-27 13:47:18 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-27 20:20:02 +0200
commit52a7dab439e53d05adb9edc870c92a446e5a9143 (patch)
treec520f44ceb27fc00369d9871033ae46e9e690213 /t/t6426-merge-skip-unneeded-updates.sh
parentbuiltin/mv duplicate string list memory (diff)
downloadgit-52a7dab439e53d05adb9edc870c92a446e5a9143.tar.xz
git-52a7dab439e53d05adb9edc870c92a446e5a9143.zip
builtin/mv: refactor to use `struct strvec`
Memory allocation patterns in git-mv(1) are extremely hard to follow: We copy around string pointers into manually-managed arrays, some of which alias each other, but only sometimes, while we also drop some of those strings at other times without ever daring to free them. While this may be my own subjective feeling, it seems like others have given up as the code has multiple calls to `UNLEAK()`. These are not sufficient though, and git-mv(1) is still leaking all over the place even with them. Refactor the code to instead track strings in `struct strvec`. While this has the effect of effectively duplicating some of the strings without an actual need, it is way easier to reason about and fixes all of the aliasing of memory that has been going on. It allows us to get rid of the `UNLEAK()` calls and also fixes leaks that those calls did not paper over. Mark tests which are now leak-free accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6426-merge-skip-unneeded-updates.sh')
-rwxr-xr-xt/t6426-merge-skip-unneeded-updates.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t6426-merge-skip-unneeded-updates.sh b/t/t6426-merge-skip-unneeded-updates.sh
index b059475ed0..62f0180325 100755
--- a/t/t6426-merge-skip-unneeded-updates.sh
+++ b/t/t6426-merge-skip-unneeded-updates.sh
@@ -22,6 +22,7 @@ test_description="merge cases"
# underscore notation is to differentiate different
# files that might be renamed into each other's paths.)
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-merge.sh