Skip to content

Commit 9396251

Browse files
vdyegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fd56fba commit 9396251

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Documentation/config/advice.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ advice.*::
6767
commitBeforeMerge::
6868
Advice shown when linkgit:git-merge[1] refuses to
6969
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.
7474
resolveConflict::
7575
Advice shown by various commands when conflicts
7676
prevent the operation from being performed.

advice.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static struct {
6161
[ADVICE_PUSH_NON_FF_MATCHING] = { "pushNonFFMatching", 1 },
6262
[ADVICE_PUSH_UNQUALIFIED_REF_NAME] = { "pushUnqualifiedRefName", 1 },
6363
[ADVICE_PUSH_UPDATE_REJECTED] = { "pushUpdateRejected", 1 },
64-
[ADVICE_RESET_QUIET_WARNING] = { "resetQuiet", 1 },
64+
[ADVICE_RESET_NO_REFRESH_WARNING] = { "resetNoRefresh", 1 },
6565
[ADVICE_RESOLVE_CONFLICT] = { "resolveConflict", 1 },
6666
[ADVICE_RM_HINTS] = { "rmHints", 1 },
6767
[ADVICE_SEQUENCER_IN_USE] = { "sequencerInUse", 1 },

advice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct string_list;
3636
ADVICE_PUSH_UPDATE_REJECTED_ALIAS,
3737
ADVICE_PUSH_UPDATE_REJECTED,
3838
ADVICE_PUSH_REF_NEEDS_UPDATE,
39-
ADVICE_RESET_QUIET_WARNING,
39+
ADVICE_RESET_NO_REFRESH_WARNING,
4040
ADVICE_RESOLVE_CONFLICT,
4141
ADVICE_RM_HINTS,
4242
ADVICE_SEQUENCER_IN_USE,

builtin/reset.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
535535
refresh_index(&the_index, flags, NULL, NULL,
536536
_("Unstaged changes after reset:"));
537537
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);
542542
}
543543
}
544544
} else {

0 commit comments

Comments
 (0)