Skip to content

Commit e86ec71

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

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Documentation/config/advice.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ advice.*::
6969
merge to avoid overwriting local changes.
7070
resetQuiet::
7171
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.
7474
resolveConflict::
7575
Advice shown by various commands when conflicts
7676
prevent the operation from being performed.

builtin/reset.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,9 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
525525
_("Unstaged changes after reset:"));
526526
t_delta_in_ms = (getnanotime() - t_begin) / 1000000;
527527
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"
529529
"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);
531531
}
532532
}
533533
} else {

0 commit comments

Comments
 (0)