t/helper: stop re-initialization of `the_repository`

While "common-main.c" already initializes `the_repository` for us, we do
so a second time in the "read-cache" test helper. This causes a memory
leak because the old repository's contents isn't released.

Stop calling `initialize_repository()` to plug this leak.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Patrick Steinhardt 2024-11-05 07:17:40 +01:00 committed by Junio C Hamano
parent 1f5ff83eab
commit a53144cf1b
2 changed files with 1 additions and 2 deletions

View File

@ -11,8 +11,6 @@ int cmd__read_cache(int argc, const char **argv)
int i, cnt = 1; int i, cnt = 1;
const char *name = NULL; const char *name = NULL;


initialize_repository(the_repository);

if (argc > 1 && skip_prefix(argv[1], "--print-and-refresh=", &name)) { if (argc > 1 && skip_prefix(argv[1], "--print-and-refresh=", &name)) {
argc--; argc--;
argv++; argv++;

View File

@ -2,6 +2,7 @@


test_description='git status with file system watcher' test_description='git status with file system watcher'


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


# Note, after "git reset --hard HEAD" no extensions exist other than 'TREE' # Note, after "git reset --hard HEAD" no extensions exist other than 'TREE'