From patchwork Wed Mar 23 18:17:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victoria Dye X-Patchwork-Id: 12790032 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5396BC433EF for ; Wed, 23 Mar 2022 18:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245500AbiCWSTh (ORCPT ); Wed, 23 Mar 2022 14:19:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244944AbiCWSTf (ORCPT ); Wed, 23 Mar 2022 14:19:35 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06957BFE for ; Wed, 23 Mar 2022 11:18:04 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id r64so1449550wmr.4 for ; Wed, 23 Mar 2022 11:18:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=2da9skEclmvTsi3KOJ4k0kUBUQr5+MHZsz1pN9h9QWk=; b=KirW+y4yYUCUcrjaD7mDJkQOnaNyfIyS9zDma6xqreDRyRq4w88sRYtNvtDnOSGndU BQq5Q07zZ1O6kbNhRZmJcuhKrXj0kOF9vM2IFnz60E5WGo4XqTdIw9tYRW3l+XHLm4hc GQVcWAhERCHYSlHbckbrB+B2X4G0ikF5Ivy41iK1uDcSLLeZXUZL8UArrjrJqF96yA4D JvJjOwnpPbEzeDxJnwqqixrNo9tdEddFaE51xXXOXchqCjinccfdgwMZ8wz/GO6j8fxl OAnOR+mHHcjLK8FUPBSrdZs9MVQy7zNmTWebBL2mgHfgeDKRa8/xQITUySL88PONoBDt eWog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=2da9skEclmvTsi3KOJ4k0kUBUQr5+MHZsz1pN9h9QWk=; b=G8/bbwzgabGocLMJRVc5qquo18vdfvGVGVQYHfwnIW0PYdp6gar5s+yBrHcbgE472w 3WY/ZH1JYfayRtUpQSrlMy/o+i1Yq06YUF6OIOFwQe3zQUSXzpPiDXFk51zPkIsVt//r cHQVQQF+wIvc8pfCZ77qQve836nqHUgiL+45kPzHga1yqhGd+L0/EiOjcF55jxeTN+Np H/haguOPWczPBeO2/Aw0Vv/7Y0FpTOyEc8KWTmsYH1JnYmLwKVdPJCVruAdqtoXJC8Im 5ExKTN66j7geKncIDw0mpqaU5b4SYR7ZySI+FJRicVnPiIUd/vPzB4QTSugTYDvwhSZX aopQ== X-Gm-Message-State: AOAM531ApG5GG87JYM0ZAFLvj346L0JQaCJ6S2SUBshvoNOJRbWCswXL 2KxyI2xg4b0abWBBJvYdIf4dr9hf254= X-Google-Smtp-Source: ABdhPJykC+gVo5l7uc8mjAcATWT7yGmdE8BzQczD97JSmPPODh2VLH3R0hBCKvV8aL6NKrFOT31PCQ== X-Received: by 2002:a05:600c:3c9b:b0:380:be98:6204 with SMTP id bg27-20020a05600c3c9b00b00380be986204mr10694418wmb.121.1648059482301; Wed, 23 Mar 2022 11:18:02 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i15-20020adffdcf000000b00203efad1d89sm659724wrs.9.2022.03.23.11.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 11:18:01 -0700 (PDT) Message-Id: <1b607e0610b6535b2cc2bbda22eb57c4bf2d11e7.1648059480.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 23 Mar 2022 18:17:58 +0000 Subject: [PATCH v2 1/3] reset: do not make '--quiet' disable index refresh Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: gitster@pobox.com, phillip.wood123@gmail.com, Victoria Dye , Victoria Dye Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Victoria Dye From: Victoria Dye Update '--quiet' to no longer implicitly skip refreshing the index in a mixed reset. Users now have the ability to explicitly disable refreshing the index with the '--no-refresh' option, so they no longer need to use '--quiet' to do so. Moreover, we explicitly remove the refresh-skipping behavior from '--quiet' because it is completely unrelated to the stated purpose of the option: "Be quiet, only report errors." Helped-by: Phillip Wood Signed-off-by: Victoria Dye --- Documentation/git-reset.txt | 5 +---- builtin/reset.c | 9 +-------- t/t7102-reset.sh | 32 +++++--------------------------- 3 files changed, 7 insertions(+), 39 deletions(-) diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt index 89ddc85c2e4..bc1646c3016 100644 --- a/Documentation/git-reset.txt +++ b/Documentation/git-reset.txt @@ -114,10 +114,7 @@ OPTIONS --no-refresh:: Proactively refresh the index after a mixed reset. If unspecified, the behavior falls back on the `reset.refresh` config option. If neither - `--[no-]refresh` nor `reset.refresh` are set, the default behavior is - decided by the `--[no-]quiet` option and/or `reset.quiet` config. - If `--quiet` is specified or `reset.quiet` is set with no command-line - "quiet" setting, refresh is disabled. Otherwise, refresh is enabled. + `--[no-]refresh` nor `reset.refresh` are set, refresh is enabled. --pathspec-from-file=:: Pathspec is passed in `` instead of commandline args. If diff --git a/builtin/reset.c b/builtin/reset.c index c8a356ec5b0..1804d0eeb84 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -392,7 +392,7 @@ static int git_reset_config(const char *var, const char *value, void *cb) int cmd_reset(int argc, const char **argv, const char *prefix) { int reset_type = NONE, update_ref_status = 0, quiet = 0; - int refresh = -1; + int refresh = 1; int patch_mode = 0, pathspec_file_nul = 0, unborn; const char *rev, *pathspec_from_file = NULL; struct object_id oid; @@ -430,13 +430,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix) PARSE_OPT_KEEP_DASHDASH); parse_args(&pathspec, argv, prefix, patch_mode, &rev); - /* - * If refresh is completely unspecified (either by config or by command - * line option), decide based on 'quiet'. - */ - if (refresh < 0) - refresh = !quiet; - if (pathspec_from_file) { if (patch_mode) die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--patch"); diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 1dc3911a060..8b62bb39b3d 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -485,25 +485,12 @@ test_reset_refreshes_index () { } test_expect_success '--mixed refreshes the index' ' - # Verify default behavior (with no config settings or command line - # options) - test_reset_refreshes_index -' -test_expect_success '--mixed --[no-]quiet sets default refresh behavior' ' - # Verify that --[no-]quiet and `reset.quiet` (without --[no-]refresh) - # determine refresh behavior - - # Config setting - ! test_reset_refreshes_index "-c reset.quiet=true" && - test_reset_refreshes_index "-c reset.quiet=false" && - - # Command line option - ! test_reset_refreshes_index "" --quiet && - test_reset_refreshes_index "" --no-quiet && + # Verify default behavior (without --[no-]refresh or reset.refresh) + test_reset_refreshes_index && - # Command line option overrides config setting - ! test_reset_refreshes_index "-c reset.quiet=false" --quiet && - test_reset_refreshes_index "-c reset.refresh=true" --no-quiet + # With --quiet & reset.quiet + test_reset_refreshes_index "-c reset.quiet=true" && + test_reset_refreshes_index "" --quiet ' test_expect_success '--mixed --[no-]refresh sets refresh behavior' ' @@ -522,15 +509,6 @@ test_expect_success '--mixed --[no-]refresh sets refresh behavior' ' ! test_reset_refreshes_index "-c reset.refresh=true" --no-refresh ' -test_expect_success '--mixed --refresh overrides --quiet refresh behavior' ' - # Verify that *both* --refresh and `reset.refresh` override the - # default non-refresh behavior of --quiet - test_reset_refreshes_index "" "--quiet --refresh" && - test_reset_refreshes_index "-c reset.quiet=true" --refresh && - test_reset_refreshes_index "-c reset.refresh=true" --quiet && - test_reset_refreshes_index "-c reset.refresh=true -c reset.quiet=true" -' - test_expect_success '--mixed preserves skip-worktree' ' echo 123 >>file2 && git add file2 && From patchwork Wed Mar 23 18:17:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victoria Dye X-Patchwork-Id: 12790033 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EB29C433EF for ; Wed, 23 Mar 2022 18:18:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245521AbiCWSTk (ORCPT ); Wed, 23 Mar 2022 14:19:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245378AbiCWSTf (ORCPT ); Wed, 23 Mar 2022 14:19:35 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE0E52ADC for ; Wed, 23 Mar 2022 11:18:04 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 123-20020a1c1981000000b0038b3616a71aso1379654wmz.4 for ; Wed, 23 Mar 2022 11:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=FAqtUY3aNNSHExO1ET3xShgHTqeDSMfT9ydrGdtkQxc=; b=LAgtBgm5V7Fiw+iv9H0S0SESnakM5XvGoLMlMeDrFs+Gl1aBRM/nOWj7jpl18ncXn+ bP7JSN5DGMRintkgW9LJ6NHF/KgynahGLGbTzryqBQ1PeCeyC4r4oPKErjX2XL4VwnZ1 Uu1z1Sbq71pa/ZJfhfWIje74MgN/0geXXy3nqZcGFJQAPp/uTratc1j4mC4D7ncpp1ka ko3x46Mo9Jhom2O4g2DyS3Hy3JK8+Tr4eo4hr7mv7SHabTLwxuIo9MA6ffUNEGXitYFV V/q2+oS+5WRU6/ep5dINLY1FJk5BNclsz7zwk4PnqVVgKXbvIgoNMtMS4d/6TDPExJ7R G61g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=FAqtUY3aNNSHExO1ET3xShgHTqeDSMfT9ydrGdtkQxc=; b=f09oRvU7fMqUbM32hVV1+GKR0sMHxf+cSH4TxuSycy6ZF643GuJShXn8q7ljFEvCUr QfFtxwPcwdxnIdLoI6lngWP6OcY1v4j+rGjwiLWkjSZw6qVDUX5S/DvEOhLfPK6zHXrg JaMbIZX2rHUfehlHsXm6QReDRbyulZJzMp47q4zW0CUsxPD9DaxJ6hHqtomxIg83Gf+l 75gVjB84qX1nN71oWmdo6l64+0OnrBn8Nrhsyfk3I6ke1fwsO+wFoF3JQl71Dk6mMnMT dnbrVU/1lWIQ8D3YilSHHWyTeLDLuGHBdNkSTgpzgft3TogPVrYIuOSvp1oHGNErNRz6 Zi3w== X-Gm-Message-State: AOAM530mX1JkaTpDiaGyF7ndkY7k+5PR8H1lm3At2paRgJxI+LRMluaV +6qhT66Y2w01rygmhvAoLie1Yiu2uA4= X-Google-Smtp-Source: ABdhPJzWGMiNXdc+xJyrmgXWYBAADgj9vrS+8+dktu7sm6fm+vtESV/D+KeLoWIWN1LuvW6KObp9RA== X-Received: by 2002:a1c:f005:0:b0:38c:b6d5:5c2a with SMTP id a5-20020a1cf005000000b0038cb6d55c2amr10786309wmb.89.1648059483243; Wed, 23 Mar 2022 11:18:03 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q16-20020adfea10000000b00203e0735791sm485712wrm.39.2022.03.23.11.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 11:18:02 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 23 Mar 2022 18:17:59 +0000 Subject: [PATCH v2 2/3] reset: remove 'reset.quiet' config option Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: gitster@pobox.com, phillip.wood123@gmail.com, Victoria Dye , Victoria Dye Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Victoria Dye From: Victoria Dye Remove the 'reset.quiet' config option, remove '--no-quiet' documentation in 'Documentation/git-reset.txt'. In 4c3abd0551 (reset: add new reset.quiet config setting, 2018-10-23), 'reset.quiet' was introduced as a way to globally change the default behavior of 'git reset --mixed' to skip index refresh. However, now that '--quiet' does not affect index refresh, 'reset.quiet' would only serve to globally silence logging. This was not the original intention of the config setting, and there's no precedent for such a setting in other commands with a '--quiet' option, so it appears to be obsolete. In addition to the options & its documentation, remove 'reset.quiet' from the recommended config for 'scalar'. Signed-off-by: Victoria Dye --- Documentation/config.txt | 2 -- Documentation/config/reset.txt | 2 -- Documentation/git-reset.txt | 5 +---- builtin/reset.c | 1 - contrib/scalar/scalar.c | 1 - t/t7102-reset.sh | 3 +-- 6 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 Documentation/config/reset.txt diff --git a/Documentation/config.txt b/Documentation/config.txt index f0fb25a371c..43f5e6fd6d3 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -495,8 +495,6 @@ include::config/repack.txt[] include::config/rerere.txt[] -include::config/reset.txt[] - include::config/sendemail.txt[] include::config/sequencer.txt[] diff --git a/Documentation/config/reset.txt b/Documentation/config/reset.txt deleted file mode 100644 index 63b7c45aac2..00000000000 --- a/Documentation/config/reset.txt +++ /dev/null @@ -1,2 +0,0 @@ -reset.quiet:: - When set to true, 'git reset' will default to the '--quiet' option. diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt index bc1646c3016..f4aca9dd35c 100644 --- a/Documentation/git-reset.txt +++ b/Documentation/git-reset.txt @@ -105,10 +105,7 @@ OPTIONS -q:: --quiet:: ---no-quiet:: - Be quiet, only report errors. The default behavior is set by the - `reset.quiet` config option. `--quiet` and `--no-quiet` will - override the default behavior. + Be quiet, only report errors. --refresh:: --no-refresh:: diff --git a/builtin/reset.c b/builtin/reset.c index 1804d0eeb84..9ce55afd1be 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -423,7 +423,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix) }; git_config(git_reset_config, NULL); - git_config_get_bool("reset.quiet", &quiet); git_config_get_bool("reset.refresh", &refresh); argc = parse_options(argc, argv, prefix, options, git_reset_usage, diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c index 7db2a97416e..58ca0e56f14 100644 --- a/contrib/scalar/scalar.c +++ b/contrib/scalar/scalar.c @@ -152,7 +152,6 @@ static int set_recommended_config(int reconfigure) { "pack.useBitmaps", "false", 1 }, { "pack.useSparse", "true", 1 }, { "receive.autoGC", "false", 1 }, - { "reset.quiet", "true", 1 }, { "feature.manyFiles", "false", 1 }, { "feature.experimental", "false", 1 }, { "fetch.unpackLimit", "1", 1 }, diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 8b62bb39b3d..9e4c4deee35 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -488,8 +488,7 @@ test_expect_success '--mixed refreshes the index' ' # Verify default behavior (without --[no-]refresh or reset.refresh) test_reset_refreshes_index && - # With --quiet & reset.quiet - test_reset_refreshes_index "-c reset.quiet=true" && + # With --quiet test_reset_refreshes_index "" --quiet ' From patchwork Wed Mar 23 18:18:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victoria Dye X-Patchwork-Id: 12790034 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0202C433F5 for ; Wed, 23 Mar 2022 18:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245584AbiCWSTm (ORCPT ); Wed, 23 Mar 2022 14:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245451AbiCWSTh (ORCPT ); Wed, 23 Mar 2022 14:19:37 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 046F8BC30 for ; Wed, 23 Mar 2022 11:18:05 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id m30so3343490wrb.1 for ; Wed, 23 Mar 2022 11:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=RnTrnB0YZMItf5oX2LhTBiW50PgAE/FsbTVw2Bm3ifY=; b=IB+a7ujheMf46EeiYbMAw26WsGenYJjwJQaKE8RpuqZ5tBuXW5hSbJXBTt02vr5bw2 KpfJYHQozFNLIpdTOTr1is+NJHAJsVZAJ+qxKriz8AE7WIF9K+MGyhOv754ccBKopj6g wFBK9seYhoyoyDKROTkypPie94kMHx5SthW6ZldNJjO6O5B7ibaFpm+GIQEudiKq/6fM TnhK2Dz+HAjUWtSO/G9JRraddORAx4zqgcX1RnjhOl2KZ3qzT9hjdIkvFIqcpkpA2ag1 3Rkx+brwFLcnijC8fZPMUTkQRC1SCHl/B3qF4TgdXNwezPnHOqnagBc2i9VM24K3SfC2 BFhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=RnTrnB0YZMItf5oX2LhTBiW50PgAE/FsbTVw2Bm3ifY=; b=a+lpUT341pPVGuhdHIhAR0jjWq/JznoqQ6ZVd8zvqFyi2rBYcghXx2Vt+VX5mw01xd 9Bof9qYbQBPixQl4lFMVNa33ZvnliiON0q7+Y7pu39GjXRMgYcmwvAdLnxa/ecjJqTbT S850aAHkmizp3m+iFMy2BLZ+e68H8Zrmu3i77YPoWpp0yMVfZxnpCbknEBa/qDL9kOev N9ivlJFy2iPqIvP+d6WsQYq/mWFxDQRMR8HGWlvXP9EFVM9QFkKdIrnfvrDjhXH19zV4 CFdh6v2EU2s8YzPU8akxjGJWqhTOdOVAQs822GI8nZzg0Hd0k1dkmXvZv9xR4CPZkhWY /7dQ== X-Gm-Message-State: AOAM533SK2cfTvx1aPWfV+U2Mzujjf4aYKl0UG+hbggXJ0UupU3JrfH/ 5E5b2txqeOj2e9WMxgYLA06KcWzhj3k= X-Google-Smtp-Source: ABdhPJyoHHTYeyRfsU/VGmPPuNYPuogpi/RPGt0hhDnEXs/pzA+QJDVOQ9pRZWk+bPWuAUHsahYrfw== X-Received: by 2002:a05:6000:186c:b0:205:3479:ad85 with SMTP id d12-20020a056000186c00b002053479ad85mr1179667wri.54.1648059484038; Wed, 23 Mar 2022 11:18:04 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id az19-20020a05600c601300b0038cadf3aa69sm6296157wmb.36.2022.03.23.11.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 11:18:03 -0700 (PDT) Message-Id: <597aa82851c77b79bd296f9c3c9bab8907fe0e95.1648059480.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 23 Mar 2022 18:18:00 +0000 Subject: [PATCH v2 3/3] reset: remove 'reset.refresh' config option Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: gitster@pobox.com, phillip.wood123@gmail.com, Victoria Dye , Victoria Dye Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Victoria Dye From: Victoria Dye Remove the 'reset.refresh' option, requiring that users explicitly specify '--no-refresh' if they want to skip refreshing the index. The 'reset.refresh' option was introduced in 101cee42dd (reset: introduce --[no-]refresh option to --mixed, 2022-03-11) as a replacement for the refresh-skipping behavior originally controlled by 'reset.quiet'. Although 'reset.refresh=false' functionally served the same purpose as 'reset.quiet=true', it exposed [1] the fact that the existence of a global "skip refresh" option could potentially cause problems for users. Allowing a global config option to avoid refreshing the index forces scripts using 'git reset --mixed' to defensively use '--refresh' if index refresh is expected; if that option is missing, behavior of a script could vary from user-to-user without explanation. Furthermore, globally disabling index refresh in 'reset --mixed' was initially devised as a passive performance improvement; since the introduction of the option, other changes have been made to Git (e.g., the sparse index) with a greater potential performance impact without sacrificing index correctness. Therefore, we can more aggressively err on the side of correctness and limit the cases of skipping index refresh to only when a user specifies the '--no-refresh' option. [1] https://lore.kernel.org/git/xmqqy2179o3c.fsf@gitster.g/ Signed-off-by: Victoria Dye --- Documentation/git-reset.txt | 4 +--- builtin/reset.c | 4 +--- t/t7102-reset.sh | 14 ++------------ 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt index f4aca9dd35c..01cb4c9b9c5 100644 --- a/Documentation/git-reset.txt +++ b/Documentation/git-reset.txt @@ -109,9 +109,7 @@ OPTIONS --refresh:: --no-refresh:: - Proactively refresh the index after a mixed reset. If unspecified, the - behavior falls back on the `reset.refresh` config option. If neither - `--[no-]refresh` nor `reset.refresh` are set, refresh is enabled. + Refresh the index after a mixed reset. Enabled by default. --pathspec-from-file=:: Pathspec is passed in `` instead of commandline args. If diff --git a/builtin/reset.c b/builtin/reset.c index 9ce55afd1be..1d89faef5ec 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -423,7 +423,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix) }; git_config(git_reset_config, NULL); - git_config_get_bool("reset.refresh", &refresh); argc = parse_options(argc, argv, prefix, options, git_reset_usage, PARSE_OPT_KEEP_DASHDASH); @@ -529,8 +528,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) t_delta_in_ms = (getnanotime() - t_begin) / 1000000; if (!quiet && advice_enabled(ADVICE_RESET_NO_REFRESH_WARNING) && t_delta_in_ms > REFRESH_INDEX_DELAY_WARNING_IN_MS) { advise(_("It took %.2f seconds to refresh the index after reset. You can use\n" - "'--no-refresh' to avoid this. Set the config setting reset.refresh to false\n" - "to make this the default."), t_delta_in_ms / 1000.0); + "'--no-refresh' to avoid this."), t_delta_in_ms / 1000.0); } } } else { diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 9e4c4deee35..22477f3a312 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -493,19 +493,9 @@ test_expect_success '--mixed refreshes the index' ' ' test_expect_success '--mixed --[no-]refresh sets refresh behavior' ' - # Verify that --[no-]refresh and `reset.refresh` control index refresh - - # Config setting - test_reset_refreshes_index "-c reset.refresh=true" && - ! test_reset_refreshes_index "-c reset.refresh=false" && - - # Command line option + # Verify that --[no-]refresh controls index refresh test_reset_refreshes_index "" --refresh && - ! test_reset_refreshes_index "" --no-refresh && - - # Command line option overrides config setting - test_reset_refreshes_index "-c reset.refresh=false" --refresh && - ! test_reset_refreshes_index "-c reset.refresh=true" --no-refresh + ! test_reset_refreshes_index "" --no-refresh ' test_expect_success '--mixed preserves skip-worktree' '