From patchwork Mon Dec 21 21:26:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_=C3=85gren?= X-Patchwork-Id: 11985325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63CBEC433DB for ; Mon, 21 Dec 2020 21:27:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 134DA22AAA for ; Mon, 21 Dec 2020 21:27:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726066AbgLUV1k (ORCPT ); Mon, 21 Dec 2020 16:27:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbgLUV1j (ORCPT ); Mon, 21 Dec 2020 16:27:39 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB537C0613D6 for ; Mon, 21 Dec 2020 13:26:58 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id o19so27162342lfo.1 for ; Mon, 21 Dec 2020 13:26:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FGFNJzWdXrwuZ/xEb9bjN2sFPJwhwmBM4cuzcL5x+C8=; b=QRYqkmlvF3MgD8YgHCanVQgB02KO7ymXvulMP5VbKQmioipT0iyqzOUGt2z45nCSMK oYmJk1oRzWoHy8M/oZ2HY+h72unfXINWvgLw93PQIteb4pfTtCogUgH4CMpU5MfAFZ6Q g+qZhyZ92mb6sxklg7TNwS2D9/co+ZT7XqvtcNW5cffde27JAcx2h0nfQXVTMY4YiK5A /RAwShoSPvp8BZP0X8ZhnrJnI5UO9FqNpHFbEb6aRjQRV+w71BkYJx1OpnyEFzabANLj HPSQ3CD/sO2AsATXce0FtIPiWmD6wHrafBNeubI3AMrPNWtGPwGw76VJ2gP+cBlwRFiy cSUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FGFNJzWdXrwuZ/xEb9bjN2sFPJwhwmBM4cuzcL5x+C8=; b=MEq5v/iEv7whR/i1FbPyzl6jzolu3DbYfqrqugXsm6wReQJSyGHISloZhb854q6M7C su7I3rkAbtIIBxxtC0rHjVBew+VJcF8QD+bDkqeJroSsukGnnSWQ/+kzgiCd+jOPT8dg Ndh99ysouSAo4ZHir4uT4jsV3jOv9lkuAvBrvrqGGhmOMtiw0eMVx+nFGVL5D/YfJ2f4 M28o8izj4tg2yRRBGHHq1OmtfutP/AToMjces/QLztqh7jFe1ENkZWI3rl62Tu3eDqlX twjRfJpMCGRuXQCLeQmWaPfHC+9t4eiGImH61CfWk1BdsfIPlXtahjWdskKNvXFjK/PB M8xQ== X-Gm-Message-State: AOAM532sIWEacXiCsyU8i/DVPWW3o62ckVTltDIoYkcKpJnMIIa49rc8 Bc17OmUnOCXhPLmz+l6lHOGOz8vovw0= X-Google-Smtp-Source: ABdhPJw81PQXWTsBiHfudcd+GoFmqAWGIYWRD2Eui8pl9beG4sVmrztFja7ym4/G9UEBxCLDt/NH2w== X-Received: by 2002:a2e:8059:: with SMTP id p25mr8305589ljg.155.1608586017242; Mon, 21 Dec 2020 13:26:57 -0800 (PST) Received: from localhost.localdomain (78-66-223-148-no2204.tbcn.telia.com. [78.66.223.148]) by smtp.gmail.com with ESMTPSA id t14sm2236100lfl.216.2020.12.21.13.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Dec 2020 13:26:56 -0800 (PST) From: =?utf-8?q?Martin_=C3=85gren?= To: git@vger.kernel.org Cc: Derrick Stolee Subject: [PATCH 1/3] git-maintenance.txt: add missing word Date: Mon, 21 Dec 2020 22:26:31 +0100 Message-Id: <7bd059244087016d2af47c6329e46191bebb168e.1608585497.git.martin.agren@gmail.com> X-Mailer: git-send-email 2.30.0.rc1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add a missing "a" before "bunch". Signed-off-by: Martin Ågren --- Documentation/git-maintenance.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-maintenance.txt b/Documentation/git-maintenance.txt index 6fec1eb8dc..d1f9b5172d 100644 --- a/Documentation/git-maintenance.txt +++ b/Documentation/git-maintenance.txt @@ -101,7 +101,7 @@ This is done to avoid disrupting the remote-tracking branches. The end users expect these refs to stay unmoved unless they initiate a fetch. With prefetch task, however, the objects necessary to complete a later real fetch would already be obtained, so the real fetch would go faster. In the ideal case, -it will just become an update to bunch of remote-tracking branches without +it will just become an update to a bunch of remote-tracking branches without any object transfer. gc:: From patchwork Mon Dec 21 21:26:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_=C3=85gren?= X-Patchwork-Id: 11985331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82178C433E6 for ; Mon, 21 Dec 2020 21:27:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3EAC622B43 for ; Mon, 21 Dec 2020 21:27:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726080AbgLUV1l (ORCPT ); Mon, 21 Dec 2020 16:27:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbgLUV1l (ORCPT ); Mon, 21 Dec 2020 16:27:41 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C31C061793 for ; Mon, 21 Dec 2020 13:27:00 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id o19so27162484lfo.1 for ; Mon, 21 Dec 2020 13:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TpIAXXiSM4wg/k3kURTL439k7yzpf3Z8Tb5lOk5tQ+8=; b=l5PjC8pa80USgwI80TUZdKrKef2Ux7X5lcWFZm5MA/pNfHCL+n3NX4+9wp85WaUVY3 jyZNxx62avCWJMtXDL26JkN60RdK+ZLVWEghKTlUwQ9NR9IOv9ZCId6L1PJ9o65QxcAR rvTj2JZLrWjEk2JHebFaeoGqVeQLN+++A6rZ2IgFW6FQtibcjsKXf9gd/vlfdHnw84TQ bAldWc+Pi2T8x+7osVIWHYRBOlNGIbwhKO2bbU98JZtaPDdcP5jLf+OXfESvtbw9461L JeKkErHT0t7W1x8AM10E0HVJ4RcxN2MOWzrXZPK6PkQ46yYIsKxsh0J1T/Pe2VMg8H0o xfXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TpIAXXiSM4wg/k3kURTL439k7yzpf3Z8Tb5lOk5tQ+8=; b=KJepMjSj98++64JXIl77Uv5vc7ja1QCuE8v9Y36fcHLD/rX1HjzI5Oz2HNijyvc1CJ UUOCj+m53WxPkE1OJKjAE2K9VM/HPyjgInd0OAgqR/+t0WGHC2LQsYx5nIbcWIzFseDR IoRHauVcpL65Bc2a8St3nvg3QcWQ2BKAXlVBH5YkqOu+d2aQBQpkEbzXKpgr02xe/HVs /UPkbcV7A1y1ZGxsjpBIbgsEGsXIVhIPCdAoRygPTr94pk0A4o5DuQJUUoYRSBhrc3BR txnewSBRR/FfN/YS0+yZwuNUN+Y2WXwFESB4H+01sRa83lhAYypQr8UNE02H2uhWQEXd 3cIQ== X-Gm-Message-State: AOAM533lgFEpC50vK7VUHgqZiXEtl5QiaHkDJJNPwhKENFoH9gdgwau5 W1y1ZTfYtTs8ndPMwAZ37667cv0aFJA= X-Google-Smtp-Source: ABdhPJyd+Hc4aLLe7w8MQ0f5yCo2zkp0KQLGC+BVQ9eA+nWUhb1LrxyaOKdyAuuweZu3dmSkBUFc6A== X-Received: by 2002:a2e:b00c:: with SMTP id y12mr7976150ljk.85.1608586018933; Mon, 21 Dec 2020 13:26:58 -0800 (PST) Received: from localhost.localdomain (78-66-223-148-no2204.tbcn.telia.com. [78.66.223.148]) by smtp.gmail.com with ESMTPSA id t14sm2236100lfl.216.2020.12.21.13.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Dec 2020 13:26:58 -0800 (PST) From: =?utf-8?q?Martin_=C3=85gren?= To: git@vger.kernel.org Cc: Derrick Stolee Subject: [PATCH 2/3] gc: fix handling of crontab magic markers Date: Mon, 21 Dec 2020 22:26:32 +0100 Message-Id: <689d3150e9822eeccac0e1d07c2ba26dac47b4c9.1608585497.git.martin.agren@gmail.com> X-Mailer: git-send-email 2.30.0.rc1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On `git maintenance start`, we add a few entries to the user's cron table. We wrap our entries using two magic markers, "# BEGIN GIT MAINTENANCE SCHEDULE" and "# END GIT MAINTENANCE SCHEDULE". At a later `git maintenance stop`, we will go through the table and remove these lines. Or rather, we will remove the "BEGIN" marker, the "END" marker and everything between them. Alas, we have a bug in how we detect the "END" marker: we don't. As we loop through all the lines of the crontab, if we are in the "old region", i.e., the region we're aiming to remove, we make an early `continue` and don't get as far as checking for the "END" marker. Thus, once we've seen our "BEGIN", we remove everything until the end of the file. Rewrite the logic for identifying these markers. There are four cases that are mutually exclusive: The current line starts a region or it ends it, or it's firmly within the region, or it's outside of it (and should be printed). Signed-off-by: Martin Ågren --- t/t7900-maintenance.sh | 7 +++++++ builtin/gc.c | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index d1e0c8f830..4bbfce31e9 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -446,6 +446,13 @@ test_expect_success 'start preserves existing schedule' ' grep "Important information!" cron.txt ' +test_expect_success 'stop preserves surrounding schedule' ' + echo "Crucial information!" >>cron.txt && + GIT_TEST_CRONTAB="test-tool crontab cron.txt" git maintenance stop && + grep "Important information!" cron.txt && + grep "Crucial information!" cron.txt +' + test_expect_success 'register preserves existing strategy' ' git config maintenance.strategy none && git maintenance register && diff --git a/builtin/gc.c b/builtin/gc.c index b57fda4924..4c24f41852 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -1554,11 +1554,10 @@ static int update_background_schedule(int run_maintenance) while (!strbuf_getline_lf(&line, cron_list)) { if (!in_old_region && !strcmp(line.buf, BEGIN_LINE)) in_old_region = 1; - if (in_old_region) - continue; - fprintf(cron_in, "%s\n", line.buf); - if (in_old_region && !strcmp(line.buf, END_LINE)) + else if (in_old_region && !strcmp(line.buf, END_LINE)) in_old_region = 0; + else if (!in_old_region) + fprintf(cron_in, "%s\n", line.buf); } if (run_maintenance) { From patchwork Mon Dec 21 21:26:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_=C3=85gren?= X-Patchwork-Id: 11985329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF283C433E9 for ; Mon, 21 Dec 2020 21:27:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6284A229F0 for ; Mon, 21 Dec 2020 21:27:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726320AbgLUV1n (ORCPT ); Mon, 21 Dec 2020 16:27:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbgLUV1m (ORCPT ); Mon, 21 Dec 2020 16:27:42 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C20DC061282 for ; Mon, 21 Dec 2020 13:27:02 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id 23so27031269lfg.10 for ; Mon, 21 Dec 2020 13:27:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Eb6ddB65gR/nN4TOG9IN8Njt61SVIXovILiSjqzi4T4=; b=cpMTq68a9HNdLi3ImCbodBQQJ7CB0GaX1TYIqWCroiAU8pQSGlmKQuIcDCGaO0SG+H iMKzO3SrE+O9OilIBDY29z7NojTxWxyxuobKveCdcxDz4Si9sFHEkfsWPKBy3onOxJ4j ae752TPAlbd3eUhRTud1sMKM0STmRalyn8Oqs4AgohrkzT/Hi6iM5MZSQNP6V7/e/knP TAHhfrv/xFpHR3TJHvVF363MQp5NNpIdxttp/3lo+7nl7AKDd0fsgNu69eYaedaKlLg/ MoUFnfjZTH9lKjvoRyKFNw9bFrj+YKC0EVAXL1W6Pp067Dgfo5gF1ywDio+08vJnUT+h oDOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Eb6ddB65gR/nN4TOG9IN8Njt61SVIXovILiSjqzi4T4=; b=ljIxBVQmYgqPQkgGzVVF/tYg1eGcGVROjljq5BdJzu0uPpuIttAyeqEVkRPPM1zhP3 M05ds2sdiRVZtpYNc9CdKA45Xyc9TYwc9AibohrYME1r9EXSXUZFLNODpFSKi1IUa2OE AXh/5EuL2G5c2gWUt0TCTSW1dCKINDet1FU4aq4asXO5ttKl35YLpc6jsU/gfJ4qSjl0 g7rFWtkj8ODYsQ5/z7XKElxI+lnVy8HQq/lPNt3Vj7FD0o0nZpz0pM19CX9bV2XR0Nry YwEPGA8pC33aMuiIhsMiD2+W4K2rqD6LeAgGB5gH4fdG7tec1zBNd8wnqkvXeWpaBvwB VBRA== X-Gm-Message-State: AOAM5317UIyk5yIt59ydAeacSCu30LSieyuFEIpzkyik6a0dfuIJInDv o3GWiIf/qL925dBd17DnEvMjDM9ZKsY= X-Google-Smtp-Source: ABdhPJwuAsPWo9qhXJDJtg+QcReRDdOQD63YavEiXQUJLR8A1T3Hgcw90nT/0nBowMOA3unM1IyfFw== X-Received: by 2002:a2e:7816:: with SMTP id t22mr7847197ljc.449.1608586020369; Mon, 21 Dec 2020 13:27:00 -0800 (PST) Received: from localhost.localdomain (78-66-223-148-no2204.tbcn.telia.com. [78.66.223.148]) by smtp.gmail.com with ESMTPSA id t14sm2236100lfl.216.2020.12.21.13.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Dec 2020 13:26:59 -0800 (PST) From: =?utf-8?q?Martin_=C3=85gren?= To: git@vger.kernel.org Cc: Derrick Stolee Subject: [PATCH 3/3] t7900-maintenance: test for magic markers Date: Mon, 21 Dec 2020 22:26:33 +0100 Message-Id: <938ac9a831bacd70e3c3ab7756ed98afa6338554.1608585497.git.martin.agren@gmail.com> X-Mailer: git-send-email 2.30.0.rc1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When we insert our "BEGIN" and "END" markers into the cron table, it's so that a Git version from many years into the future would be able to identify this region in the cron table. Let's add a test to make sure that these markers don't ever change. Signed-off-by: Martin Ågren --- t/t7900-maintenance.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 4bbfce31e9..99bf0c7582 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -446,6 +446,15 @@ test_expect_success 'start preserves existing schedule' ' grep "Important information!" cron.txt ' +test_expect_success 'magic markers are correct' ' + grep "GIT MAINTENANCE SCHEDULE" cron.txt >actual && + cat >expect <<-\EOF && + # BEGIN GIT MAINTENANCE SCHEDULE + # END GIT MAINTENANCE SCHEDULE + EOF + test_cmp actual expect +' + test_expect_success 'stop preserves surrounding schedule' ' echo "Crucial information!" >>cron.txt && GIT_TEST_CRONTAB="test-tool crontab cron.txt" git maintenance stop &&