diff options
Diffstat (limited to 'run-command.c')
-rw-r--r-- | run-command.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/run-command.c b/run-command.c index cc9c3296ba..509841bf27 100644 --- a/run-command.c +++ b/run-command.c @@ -7,6 +7,7 @@ #include "strbuf.h" #include "string-list.h" #include "quote.h" +#include "config.h" void child_process_init(struct child_process *child) { @@ -550,8 +551,11 @@ static int wait_or_whine(pid_t pid, const char *argv0, int in_signal) while ((waiting = waitpid(pid, &status, 0)) < 0 && errno == EINTR) ; /* nothing */ - if (in_signal) - return 0; + if (in_signal) { + if (WIFEXITED(status)) + code = WEXITSTATUS(status); + return code; + } if (waiting < 0) { failed_errno = errno; @@ -1866,15 +1870,18 @@ int run_processes_parallel_tr2(int n, get_next_task_fn get_next_task, return result; } -int run_auto_gc(int quiet) +int run_auto_maintenance(int quiet) { - struct strvec argv_gc_auto = STRVEC_INIT; - int status; + int enabled; + struct child_process maint = CHILD_PROCESS_INIT; + + if (!git_config_get_bool("maintenance.auto", &enabled) && + !enabled) + return 0; + + maint.git_cmd = 1; + strvec_pushl(&maint.args, "maintenance", "run", "--auto", NULL); + strvec_push(&maint.args, quiet ? "--quiet" : "--no-quiet"); - strvec_pushl(&argv_gc_auto, "gc", "--auto", NULL); - if (quiet) - strvec_push(&argv_gc_auto, "--quiet"); - status = run_command_v_opt(argv_gc_auto.v, RUN_GIT_CMD); - strvec_clear(&argv_gc_auto); - return status; + return run_command(&maint); } |