Subject: [PATCH 0/4] reset: make --no-refresh the only way to skip index refresh

From: "Victoria Dye via GitGitGadget" <[email-masked]>
Date: Mon, 21 Mar 2022 20:34:45 +0000

Maintainer's note: this is based on vd/stash-silence-reset

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

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 deprecates all instances of skipping index refresh
in 'git reset --mixed' except for '--no-refresh' itself:

 * Patch [1/4] 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/4] deprecates 'reset.quiet', since its main use was to disable
   index refresh until it was deprecated in [1/4].
 * Patch [3/4] deprecates '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.
 * Patch [4/4] removes the '--refresh' option, leaving only '--no-refresh'.
   Because nothing but '--no-refresh' can skip the 'reset' index refresh
   anymore, '--refresh' would never be needed.

[1]
https://lore.kernel.org/git/[email-masked]/
[2]
https://lore.kernel.org/git/[email-masked]/

Thanks! -Victoria

Victoria Dye (4):
  reset: do not make '--quiet' disable index refresh
  reset: deprecate 'reset.quiet' config option
  reset: deprecate 'reset.refresh' config option
  reset: deprecate '--refresh', leaving only '--no-refresh'

 Documentation/config.txt       |  2 --
 Documentation/config/reset.txt |  2 --
 Documentation/git-reset.txt    | 13 ++-------
 builtin/reset.c                | 18 +++----------
 builtin/stash.c                |  4 +--
 contrib/scalar/scalar.c        |  1 -
 t/t7102-reset.sh               | 48 +++++-----------------------------
 7 files changed, 15 insertions(+), 73 deletions(-)
 delete mode 100644 Documentation/config/reset.txt

base-commit: 4b8b0f6fa2778c1f9c373620e3f07787543914c6
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1184%2Fvdye%2Freset%2Fclean-up-refresh-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1184/vdye/reset/clean-up-refresh-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1184
-- 
gitgitgadget