]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/helper: stop re-initialization of `the_repository`
authorPatrick Steinhardt <ps@pks.im>
Tue, 5 Nov 2024 06:17:40 +0000 (07:17 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 Nov 2024 06:37:56 +0000 (22:37 -0800)
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>
t/helper/test-read-cache.c
t/t7519-status-fsmonitor.sh

index d285c656bd3a3276c7c3e1b7e5a88f2d276223ab..e277dde8e7107a61b719972c9f9065eee0abb1a3 100644 (file)
@@ -11,8 +11,6 @@ int cmd__read_cache(int argc, const char **argv)
        int i, cnt = 1;
        const char *name = NULL;
 
-       initialize_repository(the_repository);
-
        if (argc > 1 && skip_prefix(argv[1], "--print-and-refresh=", &name)) {
                argc--;
                argv++;
index 7ee69ecdd4aa2c15dbde3ba0a976d986bff17fb3..0f88a58a8192e816669b1a8231157aeac87522f8 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='git status with file system watcher'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 # Note, after "git reset --hard HEAD" no extensions exist other than 'TREE'