]> git.ipfire.org Git - thirdparty/git.git/commitdiff
reset: remove 'reset.refresh' config option
authorVictoria Dye <vdye@github.com>
Wed, 23 Mar 2022 18:18:00 +0000 (18:18 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Mar 2022 21:39:45 +0000 (14:39 -0700)
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 <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-reset.txt
builtin/reset.c
t/t7102-reset.sh

index f4aca9dd35c8912bcb209de4b49365687708b6c6..01cb4c9b9c56a7685f3a8d73fd91cadf5ce7a9e6 100644 (file)
@@ -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=<file>::
        Pathspec is passed in `<file>` instead of commandline args. If
index 9ce55afd1bec4303e715dbc25d06e396b1e570d9..1d89faef5ece4e2413a7de1d3f081097b34b4dce 100644 (file)
@@ -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 {
index 9e4c4deee3596d0e3f4a2a43b1f627ef4f85a8d7..22477f3a312e4a44b0c3f99ee356d29487ed5399 100755 (executable)
@@ -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' '