From 05c324b92fe723674cbf9ae1b0b1675821b6c275 Mon Sep 17 00:00:00 2001 From: Burak Kaan Karaçay Date: Thu, 12 Mar 2026 17:44:36 +0300 Subject: run-command: wean start_command() off the_repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The start_command() relies on the_repository due to the close_object_store flag in 'struct child_process'. When this flag is set, start_command() closes the object store associated with the_repository before spawning a child process. To eliminate this dependency, replace the 'close_object_store' with the new 'struct object_database *odb_to_close' field. This allows callers to specify the object store that needs to be closed. Suggested-by: René Scharfe Signed-off-by: Burak Kaan Karaçay Signed-off-by: Junio C Hamano --- run-command.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'run-command.c') diff --git a/run-command.c b/run-command.c index b27064ef57..ed5e8be976 100644 --- a/run-command.c +++ b/run-command.c @@ -742,8 +742,8 @@ fail_pipe: fflush(NULL); - if (cmd->close_object_store) - odb_close(the_repository->objects); + if (cmd->odb_to_close) + odb_close(cmd->odb_to_close); #ifndef GIT_WINDOWS_NATIVE { @@ -1955,7 +1955,7 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint) auto_detach = git_env_bool("GIT_TEST_MAINT_AUTO_DETACH", true); maint->git_cmd = 1; - maint->close_object_store = 1; + maint->odb_to_close = the_repository->objects; strvec_pushl(&maint->args, "maintenance", "run", "--auto", NULL); strvec_push(&maint->args, quiet ? "--quiet" : "--no-quiet"); strvec_push(&maint->args, auto_detach ? "--detach" : "--no-detach"); -- cgit v1.3