mirror of
https://github.com/git/git
synced 2024-10-02 14:45:21 +00:00
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
This commit is contained in:
commit
5c7ffafcea
|
@ -8,7 +8,7 @@ receive.advertisePushOptions::
|
|||
capability to its clients. False by default.
|
||||
|
||||
receive.autogc::
|
||||
By default, git-receive-pack will run "git-gc --auto" after
|
||||
By default, git-receive-pack will run "git maintenance run --auto" after
|
||||
receiving data from git-push and updating refs. You can stop
|
||||
it by setting this variable to false.
|
||||
|
||||
|
|
|
@ -2585,17 +2585,16 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
|
|||
if (auto_gc) {
|
||||
struct child_process proc = CHILD_PROCESS_INIT;
|
||||
|
||||
proc.no_stdin = 1;
|
||||
proc.stdout_to_stderr = 1;
|
||||
proc.err = use_sideband ? -1 : 0;
|
||||
proc.git_cmd = proc.close_object_store = 1;
|
||||
strvec_pushl(&proc.args, "gc", "--auto", "--quiet",
|
||||
NULL);
|
||||
if (prepare_auto_maintenance(1, &proc)) {
|
||||
proc.no_stdin = 1;
|
||||
proc.stdout_to_stderr = 1;
|
||||
proc.err = use_sideband ? -1 : 0;
|
||||
|
||||
if (!start_command(&proc)) {
|
||||
if (use_sideband)
|
||||
copy_to_sideband(proc.err, -1, NULL);
|
||||
finish_command(&proc);
|
||||
if (!start_command(&proc)) {
|
||||
if (use_sideband)
|
||||
copy_to_sideband(proc.err, -1, NULL);
|
||||
finish_command(&proc);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (auto_update_server_info)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue