]> git.ipfire.org Git - thirdparty/git.git/commitdiff
reset: revise index refresh advice
authorVictoria Dye <vdye@github.com>
Tue, 15 Mar 2022 01:49:38 +0000 (01:49 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Mar 2022 01:51:56 +0000 (18:51 -0700)
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>
Documentation/config/advice.txt
builtin/reset.c

index c40eb09cb7e97104d2b5b44b89c4fd1d087f5d33..971aad2f237c4a4246f34e790400d87b34cf47c2 100644 (file)
@@ -69,8 +69,8 @@ advice.*::
                merge to avoid overwriting local changes.
        resetQuiet::
                Advice to consider using the `--quiet` option to linkgit:git-reset[1]
-               when the command takes more than 2 seconds to enumerate unstaged
-               changes after reset.
+               when the command takes more than 2 seconds to refresh the index
+               after reset.
        resolveConflict::
                Advice shown by various commands when conflicts
                prevent the operation from being performed.
index 6e65e90c5db107c649f533f33d0977d319fdc93c..a420497a14fb15a2ee0f55b71600e3142d1778fb 100644 (file)
@@ -525,9 +525,9 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
                                              _("Unstaged changes after reset:"));
                                t_delta_in_ms = (getnanotime() - t_begin) / 1000000;
                                if (advice_enabled(ADVICE_RESET_QUIET_WARNING) && t_delta_in_ms > REFRESH_INDEX_DELAY_WARNING_IN_MS) {
-                                       printf(_("\nIt took %.2f seconds to enumerate unstaged changes after reset.  You can\n"
+                                       advise(_("It took %.2f seconds to refresh the index after reset.  You can\n"
                                                "use '--quiet' to avoid this.  Set the config setting reset.quiet to true\n"
-                                               "to make this the default.\n"), t_delta_in_ms / 1000.0);
+                                               "to make this the default."), t_delta_in_ms / 1000.0);
                                }
                        }
                } else {