From 5a22a334cb757753230f1d73da36130513016830 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 9 Sep 2021 09:47:07 +0000 Subject: run_auto_maintenance(): implicitly close the object store Before spawning the auto maintenance, we need to make sure that we release all open file handles to all the `.pack` files (and MIDX files and commit-graph files and...) so that the maintenance process has the freedom to delete those files. So far, we did this manually every time before calling `run_auto_maintenance()`. With the new `close_object_store` flag, we can do that implicitly in that function, which is more robust because future callers won't be able to forget to close the object store. Note: this changes behavior slightly, as we previously _always_ closed the object store, but now we only close the object store when actually running the auto maintenance. In practice, this should not matter (if anything, it might speed up operations where auto maintenance is disabled). Suggested-by: Junio C Hamano Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- run-command.c | 1 + 1 file changed, 1 insertion(+) (limited to 'run-command.c') diff --git a/run-command.c b/run-command.c index e2dc624377..229bdff997 100644 --- a/run-command.c +++ b/run-command.c @@ -1891,6 +1891,7 @@ int run_auto_maintenance(int quiet) return 0; maint.git_cmd = 1; + maint.close_object_store = 1; strvec_pushl(&maint.args, "maintenance", "run", "--auto", NULL); strvec_push(&maint.args, quiet ? "--quiet" : "--no-quiet"); -- cgit v1.2.3