reset: replace '--quiet' with '--no-refresh' in performance advice

Replace references to '--quiet' with '--no-refresh' in the advice on how to skip refreshing the index. When the advice was introduced, '--quiet' was the only way to avoid the expensive 'refresh_index(...)' at the end of a mixed reset. After introducing '--no-refresh', however, '--quiet' became only a fallback option for determining refresh behavior, overridden by '--[no-]refresh' or 'reset.refresh' if either is set. To ensure users are advised to use the most reliable option for avoiding 'refresh_index(...)', replace recommendation of '--quiet' with '--[no-]refresh'. Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Victoria Dye committed Mar 15, 2022 at 01:49 UTC 9396251b371b9475b60461ddb27bd22282c86d79
4 files changed +10 -10
Documentation/config/advice.txt
+4 -4
@@ -67,10 +67,10 @@ advice.*::
67 commitBeforeMerge::
68 Advice shown when linkgit:git-merge[1] refuses to
69 merge to avoid overwriting local changes.
70 - resetQuiet::
71 - Advice to consider using the `--quiet` option to linkgit:git-reset[1]
72 - when the command takes more than 2 seconds to refresh the index
73 - after reset.
70 + resetNoRefresh::
71 + Advice to consider using the `--no-refresh` option to
72 + linkgit:git-reset[1] when the command takes more than 2 seconds
73 + to refresh the index after reset.
74 resolveConflict::
75 Advice shown by various commands when conflicts
76 prevent the operation from being performed.
advice.c
+1 -1
@@ -61,7 +61,7 @@ static struct {
61 [ADVICE_PUSH_NON_FF_MATCHING] = { "pushNonFFMatching", 1 },
62 [ADVICE_PUSH_UNQUALIFIED_REF_NAME] = { "pushUnqualifiedRefName", 1 },
63 [ADVICE_PUSH_UPDATE_REJECTED] = { "pushUpdateRejected", 1 },
64 - [ADVICE_RESET_QUIET_WARNING] = { "resetQuiet", 1 },
64 + [ADVICE_RESET_NO_REFRESH_WARNING] = { "resetNoRefresh", 1 },
65 [ADVICE_RESOLVE_CONFLICT] = { "resolveConflict", 1 },
66 [ADVICE_RM_HINTS] = { "rmHints", 1 },
67 [ADVICE_SEQUENCER_IN_USE] = { "sequencerInUse", 1 },
advice.h
+1 -1
@@ -36,7 +36,7 @@ struct string_list;
36 ADVICE_PUSH_UPDATE_REJECTED_ALIAS,
37 ADVICE_PUSH_UPDATE_REJECTED,
38 ADVICE_PUSH_REF_NEEDS_UPDATE,
39 - ADVICE_RESET_QUIET_WARNING,
39 + ADVICE_RESET_NO_REFRESH_WARNING,
40 ADVICE_RESOLVE_CONFLICT,
41 ADVICE_RM_HINTS,
42 ADVICE_SEQUENCER_IN_USE,
builtin/reset.c
+4 -4
@@ -535,10 +535,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
535 refresh_index(&the_index, flags, NULL, NULL,
536 _("Unstaged changes after reset:"));
537 t_delta_in_ms = (getnanotime() - t_begin) / 1000000;
538 - if (advice_enabled(ADVICE_RESET_QUIET_WARNING) && t_delta_in_ms > REFRESH_INDEX_DELAY_WARNING_IN_MS) {
539 - advise(_("It took %.2f seconds to refresh the index after reset. You can\n"
540 - "use '--quiet' to avoid this. Set the config setting reset.quiet to true\n"
541 - "to make this the default."), t_delta_in_ms / 1000.0);
538 + if (advice_enabled(ADVICE_RESET_NO_REFRESH_WARNING) && t_delta_in_ms > REFRESH_INDEX_DELAY_WARNING_IN_MS) {
539 + advise(_("It took %.2f seconds to refresh the index after reset. You can use\n"
540 + "'--no-refresh' to avoid this. Set the config setting reset.refresh to false\n"
541 + "to make this the default."), t_delta_in_ms / 1000.0);
542 }
543 }
544 } else {