reset: revise index refresh advice
Update the advice describing index refresh from "enumerate unstaged changes" to "refresh the index." Describing 'refresh_index(...)' as "enumerating unstaged changes" is not fully representative of what an index refresh is doing; more generally, it updates the properties of index entries that are affected by outside-of-index state, e.g. CE_UPTODATE, which is affected by the file contents on-disk. This distinction is relevant to operations that read the index but do not refresh first - e.g., 'git read-tree' - where a stale index may cause incorrect behavior. In addition to changing the advice message, use the "advise" function to print advice. 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
e86ec71d20d14861e4a3d047800d3ea3099c946d
2 files changed
+4
-4
Documentation/config/advice.txt
+2
-2
@@ -69,8 +69,8 @@ advice.*::
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 enumerate unstaged
73
- changes after reset.
72
+ when the command takes more than 2 seconds to refresh the index
73
+ after reset.
74
resolveConflict::
75
Advice shown by various commands when conflicts
76
prevent the operation from being performed.
builtin/reset.c
+2
-2
@@ -525,9 +525,9 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
525
_("Unstaged changes after reset:"));
526
t_delta_in_ms = (getnanotime() - t_begin) / 1000000;
527
if (advice_enabled(ADVICE_RESET_QUIET_WARNING) && t_delta_in_ms > REFRESH_INDEX_DELAY_WARNING_IN_MS) {
528
- printf(_("\nIt took %.2f seconds to enumerate unstaged changes after reset. You can\n"
528
+ advise(_("It took %.2f seconds to refresh the index after reset. You can\n"
529
"use '--quiet' to avoid this. Set the config setting reset.quiet to true\n"
530
- "to make this the default.\n"), t_delta_in_ms / 1000.0);
530
+ "to make this the default."), t_delta_in_ms / 1000.0);
531
}
532
}
533
} else {