summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2020-08-28 15:45:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-09-25 17:59:44 (GMT)
commit1942d48380fec53f76361e9adebef15b5db9628a (patch)
tree22f3cce07f538def0328d09ddf15e283ec1ada76 /run-command.c
parente841a79a131d8ce491cf04d0ca3e24f139a10b82 (diff)
downloadgit-1942d48380fec53f76361e9adebef15b5db9628a.zip
git-1942d48380fec53f76361e9adebef15b5db9628a.tar.gz
git-1942d48380fec53f76361e9adebef15b5db9628a.tar.bz2
maintenance: optionally skip --auto process
Some commands run 'git maintenance run --auto --[no-]quiet' after doing their normal work, as a way to keep repositories clean as they are used. Currently, users who do not want this maintenance to occur would set the 'gc.auto' config option to 0 to avoid the 'gc' task from running. However, this does not stop the extra process invocation. On Windows, this extra process invocation can be more expensive than necessary. Allow users to drop this extra process by setting 'maintenance.auto' to 'false'. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/run-command.c b/run-command.c
index 2ee59ac..ea4d0fb 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)
{
@@ -1868,8 +1869,13 @@ int run_processes_parallel_tr2(int n, get_next_task_fn get_next_task,
int run_auto_maintenance(int quiet)
{
+ 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");