From b396ee6bed7882af3333eb52333f8a34b648437d Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 17 Apr 2024 08:16:31 +0200 Subject: run-command: introduce function to prepare auto-maintenance process The `run_auto_maintenance()` function is responsible for spawning a new `git maintenance run --auto` process. To do so, it sets up the `sturct child_process` and then runs it by executing `run_command()` directly. This is rather inflexible in case callers want to modify the child process somewhat, e.g. to redirect stderr or stdout. Introduce a new `prepare_auto_maintenance()` function to plug this gap. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- run-command.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'run-command.h') diff --git a/run-command.h b/run-command.h index 1f22cc3827..55f6631a2a 100644 --- a/run-command.h +++ b/run-command.h @@ -217,6 +217,13 @@ int finish_command_in_signal(struct child_process *); */ int run_command(struct child_process *); +/* + * Prepare a `struct child_process` to run auto-maintenance. Returns 1 if the + * process has been prepared and is ready to run, or 0 in case auto-maintenance + * should be skipped. + */ +int prepare_auto_maintenance(int quiet, struct child_process *maint); + /* * Trigger an auto-gc */ -- cgit v1.3