diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-08-26 11:32:20 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-26 11:32:20 -0700 |
| commit | 1e8962ee082934a60b5fc71fab0e36cb1cab39bd (patch) | |
| tree | 832b7058ac8f5b9d941ab2cbfd10e84854262d21 /run-command.c | |
| parent | 6a09c36371cbb902c573aee38d7cfd38f884f448 (diff) | |
| parent | 98077d06b28b97d508c389886ee5014056707a5e (diff) | |
| download | git-1e8962ee082934a60b5fc71fab0e36cb1cab39bd.tar.xz | |
Merge branch 'ps/maintenance-detach-fix'
Maintenance tasks other than "gc" now properly go background when
"git maintenance" runs them.
* ps/maintenance-detach-fix:
run-command: fix detaching when running auto maintenance
builtin/maintenance: add a `--detach` flag
builtin/gc: add a `--detach` flag
builtin/gc: stop processing log file on signal
builtin/gc: fix leaking config values
builtin/gc: refactor to read config into structure
config: fix constness of out parameter for `git_config_get_expiry()`
Diffstat (limited to 'run-command.c')
| -rw-r--r-- | run-command.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/run-command.c b/run-command.c index 45ba544932..94f2f3079f 100644 --- a/run-command.c +++ b/run-command.c @@ -1808,16 +1808,26 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts) int prepare_auto_maintenance(int quiet, struct child_process *maint) { - int enabled; + int enabled, auto_detach; if (!git_config_get_bool("maintenance.auto", &enabled) && !enabled) return 0; + /* + * When `maintenance.autoDetach` isn't set, then we fall back to + * honoring `gc.autoDetach`. This is somewhat weird, but required to + * retain behaviour from when we used to run git-gc(1) here. + */ + if (git_config_get_bool("maintenance.autodetach", &auto_detach) && + git_config_get_bool("gc.autodetach", &auto_detach)) + auto_detach = 1; + 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"); + strvec_push(&maint->args, auto_detach ? "--detach" : "--no-detach"); return 1; } |
