diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-04-23 15:05:56 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-04-23 15:05:56 -0700 |
| commit | 5c7ffafcea5fe37d435cc684d59eee91696dfb9f (patch) | |
| tree | 92cf92dfae892cb60d6fc974cda2b11a01b5fc3e /run-command.c | |
| parent | 5b7877482082698a730f1045c78cf90af544ab6c (diff) | |
| parent | 7bf3057d9cf569bcbdf3c1b43cce0eacde98a20b (diff) | |
| download | git-5c7ffafcea5fe37d435cc684d59eee91696dfb9f.tar.xz | |
Merge branch 'ps/run-auto-maintenance-in-receive-pack'
The "receive-pack" program (which responds to "git push") was not
converted to run "git maintenance --auto" when other codepaths that
used to run "git gc --auto" were updated, which has been corrected.
* ps/run-auto-maintenance-in-receive-pack:
builtin/receive-pack: convert to use git-maintenance(1)
run-command: introduce function to prepare auto-maintenance process
Diffstat (limited to 'run-command.c')
| -rw-r--r-- | run-command.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/run-command.c b/run-command.c index 0e7435718a..1b821042b4 100644 --- a/run-command.c +++ b/run-command.c @@ -1793,20 +1793,27 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts) trace2_region_leave(tr2_category, tr2_label, NULL); } -int run_auto_maintenance(int quiet) +int prepare_auto_maintenance(int quiet, struct child_process *maint) { int enabled; - struct child_process maint = CHILD_PROCESS_INIT; if (!git_config_get_bool("maintenance.auto", &enabled) && !enabled) 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"); + 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"); + + return 1; +} +int run_auto_maintenance(int quiet) +{ + struct child_process maint = CHILD_PROCESS_INIT; + if (!prepare_auto_maintenance(quiet, &maint)) + return 0; return run_command(&maint); } |
