From: Patrick Steinhardt Date: Tue, 5 Nov 2024 06:17:40 +0000 (+0100) Subject: t/helper: stop re-initialization of `the_repository` X-Git-Tag: v2.48.0-rc0~65^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a53144cf1bfc5ef5b4d8b58311ea83e32e00a69f;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c index d285c656bd..e277dde8e7 100644 --- a/t/helper/test-read-cache.c +++ b/t/helper/test-read-cache.c @@ -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++; diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh index 7ee69ecdd4..0f88a58a81 100755 --- a/t/t7519-status-fsmonitor.sh +++ b/t/t7519-status-fsmonitor.sh @@ -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'