Skip to content

pr-1184/vdye/reset/clean-up-refresh-v2

Maintainer's note: this is based on vd/stash-silence-reset (specifically,
4b8b0f6fa2 (stash: make internal resets quiet and refresh index,
2022-03-15)).

----------------------------------------------------------------------------

This is a follow-up to the changes in vd/stash-silence-reset [1], in which
index refreshing behavior was decoupled from log silencing in the '--quiet'
option to 'git reset --mixed' by introducing a '--[no-]refresh' option and
'reset.refresh' config setting.

After some discussion [2] on the mailing list, both the
backward-compatibility and use of global options in that series came into
question:

 * '--quiet' still skipped refresh if neither '--[no-]refresh' nor
   'reset.refresh' were specified, meaning that users could still be left
   with an incorrect index state after reset.
 * Having 'reset.quiet' and/or 'reset.refresh' potentially disable index
   refresh by default meant that developers would need to defensively add
   '--refresh' to all internal uses of 'git reset --mixed'. Without that
   option, different config setups could cause variability in index
   correctness from user to user.

In response, this series removes all methods of skipping index refresh in
'git reset --mixed' except for '--no-refresh' itself:

 * Patch [1/3] removes the "fallback" behavior of 'reset.quiet' and
   '--quiet' implying '--no-refresh' if neither '--[no-]refresh' nor
   'config.refresh' were specified. In other words, '--quiet' no longer does
   anything other than log silencing.
 * Patch [2/3] removes 'reset.quiet', since its main use was to disable
   index refresh until that behavior was removed in [1/3].
 * Patch [3/3] removes 'reset.refresh' to avoid users accidentally ending up
   with an incorrect index state after all resets as a result of a global
   setting's passive effects.

Changes since V1
================

 * Dropped patch that removed '--refresh', again allowing both
   '--no-refresh' and '--refresh' as valid options.
 * Updated documentation of "--refresh" option to remove unnecessary
   "proactively".
 * Reworded commit titles to change "deprecate" to the more accurate
   "remove".

[1]
https://lore.kernel.org/git/pull.1170.v3.git.1647308982.gitgitgadget@gmail.com/
[2]
https://lore.kernel.org/git/80a2a5a2-256f-6c3b-2430-10bef99ce1e9@github.com/

Thanks! -Victoria

Victoria Dye (3):
  reset: do not make '--quiet' disable index refresh
  reset: remove 'reset.quiet' config option
  reset: remove 'reset.refresh' config option

 Documentation/config.txt       |  2 --
 Documentation/config/reset.txt |  2 --
 Documentation/git-reset.txt    | 12 ++-------
 builtin/reset.c                | 14 ++---------
 contrib/scalar/scalar.c        |  1 -
 t/t7102-reset.sh               | 45 +++++-----------------------------
 6 files changed, 10 insertions(+), 66 deletions(-)
 delete mode 100644 Documentation/config/reset.txt

base-commit: 877d90220e42b40cf5b899dc36a13c348220b54c

Submitted-As: https://lore.kernel.org/git/pull.1184.v2.git.1648059480.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.1184.git.1647894889.gitgitgadget@gmail.com
Assets 2