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>

Patrick Steinhardt committed Nov 5, 2024 at 07:17 UTC a53144cf1bfc5ef5b4d8b58311ea83e32e00a69f
2 files changed +1 -2
t/helper/test-read-cache.c
-2
@@ -11,8 +11,6 @@ int cmd__read_cache(int argc, const char **argv)
11 int i, cnt = 1;
12 const char *name = NULL;
13
14 - initialize_repository(the_repository);
15 -
14 if (argc > 1 && skip_prefix(argv[1], "--print-and-refresh=", &name)) {
15 argc--;
16 argv++;
t/t7519-status-fsmonitor.sh
+1
@@ -2,6 +2,7 @@
2
3 test_description='git status with file system watcher'
4
5 +TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 # Note, after "git reset --hard HEAD" no extensions exist other than 'TREE'