From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 857CA1F4B4 for ; Thu, 15 Oct 2020 17:22:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404907AbgJORWI (ORCPT ); Thu, 15 Oct 2020 13:22:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390565AbgJORWH (ORCPT ); Thu, 15 Oct 2020 13:22:07 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AC77C0613D2 for ; Thu, 15 Oct 2020 10:22:07 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id q5so4675481wmq.0 for ; Thu, 15 Oct 2020 10:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=i23re7jsKeggERrBXtJjshBZV8NteQPTfOTlXWmSBic=; b=rje8NCJ4nJTefjAe3yTDkoFuyZC7RinEzv9+FxQh7Z+P7sBQAyTngfmS8Hp75U14YJ pLkXN37QcdnDbEE6XZHg5MyekQ24H2FajZojv8X1+3lw2lug01dMGpBaR7rBuN/WrgUo KcvJGz/z9sSi4rPgePI0f1paBBTu73YX5QBCIUVRxeaYd4i2pRrr0pWd830usfRqRtHJ 1hMlkcBcCw4ia7kjRrf+/akRKqWRRzz6rQiG10v8FKhrYenTOFBJVKbRMGpf9T5QzQJz eXx4LKjTo2mBG4fibbSfJeam0vW9h9DDwtk3QT1IpU98Byjz6pArlrUj8hS3dbGgfFgn pn4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=i23re7jsKeggERrBXtJjshBZV8NteQPTfOTlXWmSBic=; b=kjRhoUgSCd4//x7s50C5EiVOJZlF3sMfTLGje3t8InqaK9phEuE/Ggx+itBnuuOri+ 911egWa2pg3SjmKk50lczEkxUERWE3s2X1f4OqDxrtS/Y6JhNtJjOVJrXVtwyMkytC46 n9s1tiE4E8cEqv1WocjICOwqADD3PNccigG16fCnHS0cbfWumAgonpR9GZKj8aYDWD5L KWOqZKcanicPpEr2pavYsbl15b4+Mwl2B9D661nYUy0aVZgCq/NRdY3Nm2B0TnZ3himM 1zH6JlitpefunVXkoA9WZLF8Jg3fsvJrtYCEHsGsJbKd+1tViOGrW5kaWSriLZzire+3 S63g== X-Gm-Message-State: AOAM5308sxLHCmQpgY7nFuhzn1S9Oe8zF0ld16tJuhTGoIMHUmXxBFwb Bh69f28u0DLhSrQar20lrf4qdguYqwY= X-Google-Smtp-Source: ABdhPJyEJVu6QdeYJ+UK1Ppxhhq0zUqDhQi8nxZvTw1GJPHcEHf0s01QcBEgrrifhm0q4qhymnKbRw== X-Received: by 2002:a7b:cb09:: with SMTP id u9mr5037982wmj.109.1602782526119; Thu, 15 Oct 2020 10:22:06 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h4sm6136944wrv.11.2020.10.15.10.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 10:22:05 -0700 (PDT) Message-Id: <02e7286dba906f6cd729537d1f22e98ba4154c55.1602782524.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Date: Thu, 15 Oct 2020 17:21:57 +0000 Subject: [PATCH v4 1/8] maintenance: optionally skip --auto process Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 To: git@vger.kernel.org Cc: jrnieder@gmail.com, jonathantanmy@google.com, sluongng@gmail.com, congdanhqx@gmail.com, SZEDER =?UTF-8?Q?G=C3=A1bor?= , Derrick Stolee , =?UTF-8?Q?=C4=90o=C3=A0n_Tr=E1=BA=A7n_C=C3=B4ng?= Danh , Martin =?UTF-8?Q?=C3=85gren?= , Derrick Stolee , Derrick Stolee Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee 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 --- Documentation/config/maintenance.txt | 5 +++++ run-command.c | 6 ++++++ t/t7900-maintenance.sh | 13 +++++++++++++ 3 files changed, 24 insertions(+) diff --git a/Documentation/config/maintenance.txt b/Documentation/config/maintenance.txt index a0706d8f09..06db758172 100644 --- a/Documentation/config/maintenance.txt +++ b/Documentation/config/maintenance.txt @@ -1,3 +1,8 @@ +maintenance.auto:: + This boolean config option controls whether some commands run + `git maintenance run --auto` after doing their normal work. Defaults + to true. + maintenance..enabled:: This boolean config option controls whether the maintenance task with name `` is run when no `--task` option is specified to diff --git a/run-command.c b/run-command.c index 2ee59acdc8..ea4d0fb4b1 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"); diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 55116c2f04..c7caaa7a55 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -28,6 +28,19 @@ test_expect_success 'run [--auto|--quiet]' ' test_subcommand git gc --no-quiet .enabled' ' git config maintenance.gc.enabled false && git config maintenance.commit-graph.enabled true && -- gitgitgadget