From fd56fba97f26bf668749207efd6a45aee2e2f57c Mon Sep 17 00:00:00 2001 From: Victoria Dye Date: Tue, 15 Mar 2022 01:49:39 +0000 Subject: reset: introduce --[no-]refresh option to --mixed Add a new --[no-]refresh option that is intended to explicitly determine whether a mixed reset should end in an index refresh. Starting at 9ac8125d1a (reset: don't compute unstaged changes after reset when --quiet, 2018-10-23), using the '--quiet' option results in skipping the call to 'refresh_index(...)' at the end of a mixed reset with the goal of improving performance. However, by coupling behavior that modifies the index with the option that silences logs, there is no way for users to have one without the other (i.e., silenced logs with a refreshed index) without incurring the overhead of a separate call to 'git update-index --refresh'. Furthermore, there is minimal user-facing documentation indicating that --quiet skips the index refresh, potentially leading to unexpected issues executing commands after 'git reset --quiet' that do not themselves refresh the index (e.g., internals of 'git stash', 'git read-tree'). To mitigate these issues, '--[no-]refresh' and 'reset.refresh' are introduced to provide a dedicated mechanism for refreshing the index. When either is set, '--quiet' and 'reset.quiet' revert to controlling only whether logs are silenced and do not affect index refresh. Helped-by: Derrick Stolee Helped-by: Junio C Hamano Signed-off-by: Victoria Dye Signed-off-by: Junio C Hamano --- Documentation/git-reset.txt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Documentation/git-reset.txt') diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt index 6f7685f53d..89ddc85c2e 100644 --- a/Documentation/git-reset.txt +++ b/Documentation/git-reset.txt @@ -110,6 +110,15 @@ OPTIONS `reset.quiet` config option. `--quiet` and `--no-quiet` will override the default behavior. +--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, 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. + --pathspec-from-file=:: Pathspec is passed in `` instead of commandline args. If `` is exactly `-` then standard input is used. Pathspec -- cgit v1.2.3 From 45bf76284b40856e47e8809e952167f0316b8a99 Mon Sep 17 00:00:00 2001 From: Victoria Dye Date: Wed, 23 Mar 2022 18:17:58 +0000 Subject: reset: do not make '--quiet' disable index refresh 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 Signed-off-by: Junio C Hamano --- Documentation/git-reset.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Documentation/git-reset.txt') diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt index 89ddc85c2e..bc1646c301 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 -- cgit v1.2.3 From 2efc9b84e5e9ea063ecfb2f813cb56653a03c10a Mon Sep 17 00:00:00 2001 From: Victoria Dye Date: Wed, 23 Mar 2022 18:17:59 +0000 Subject: reset: remove 'reset.quiet' config option 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 Signed-off-by: Junio C Hamano --- Documentation/git-reset.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Documentation/git-reset.txt') diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt index bc1646c301..f4aca9dd35 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:: -- cgit v1.2.3 From 7cff6765fe5c1ce97f4afba9432c8aa5c5f877ba Mon Sep 17 00:00:00 2001 From: Victoria Dye Date: Wed, 23 Mar 2022 18:18:00 +0000 Subject: reset: remove 'reset.refresh' config option 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 Signed-off-by: Junio C Hamano --- Documentation/git-reset.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Documentation/git-reset.txt') diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt index f4aca9dd35..01cb4c9b9c 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 -- cgit v1.2.3