Re: [PATCH v2] status: long status advice adapted to recent capabilities
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Nov 2, 2022, 23:59 UTC
- Message-ID
- <Y2MEXyhh2cJ14ba9@nand.local>
- In-Reply-To
- <8abc5272-4e01-e793-5155-ea116e9ad4fd@jeffhostetler.com>
On Wed, Nov 02, 2022 at 03:45:18PM -0400, Jeff Hostetler wrote:
Show 5 quoted lines
> Let me suggest an alternative commit message. We want to lead with a > "command" -- as in: "make Git do this" or "teach Git to do this". Then > explain why. Maybe something like: > > [...]
Excellent suggestions, thank you.
Show 42 quoted lines
> > @@ -1870,13 +1884,25 @@ static void wt_longstatus_print(struct wt_status *s)
> > wt_longstatus_print_other(s, &s->untracked, _("Untracked files"), "add");
> > if (s->show_ignored_mode)
> > wt_longstatus_print_other(s, &s->ignored, _("Ignored files"), "add -f");
> > - if (advice_enabled(ADVICE_STATUS_U_OPTION) && 2000 < s->untracked_in_ms) {
> > - status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
> > - status_printf_ln(s, GIT_COLOR_NORMAL,
> > - _("It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
> > - "may speed it up, but you have to be careful not to forget to add\n"
> > - "new files yourself (see 'git help status')."),
> > - s->untracked_in_ms / 1000.0);
> > + if (uf_was_slow(s->untracked_in_ms)) {
> > + if (advice_enabled(ADVICE_STATUS_U_OPTION)) {
> > + status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
> > + if (s->repo->settings.core_untracked_cache == UNTRACKED_CACHE_WRITE) {
> > + status_printf_ln(s, GIT_COLOR_NORMAL,
> > + _("It took %.2f seconds to enumerate untracked files,\n"
> > + "but this is currently being cached, with fsmonitor %s."),
> > + s->untracked_in_ms / 1000.0,
> > + (fsm_mode > FSMONITOR_MODE_DISABLED) ? "ON" : "OFF");
> > + } else {
> > + status_printf_ln(s, GIT_COLOR_NORMAL,
> > + _("It took %.2f seconds to enumerate untracked files."),
> > + s->untracked_in_ms / 1000.0);
> > + }
> > + status_printf_ln(s, GIT_COLOR_NORMAL,
> > + _("See https://git-scm.com/docs/git-status#_untracked_files_and_status_speed\n"
> > + "for configuration options that may improve that time."));
> > + status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
> > + }
>
> I'm not sure I like the various mixture of messages here. Maybe
> it would be better with a single simple message:
>
> _("It took %.2f seconds to enumerate untracked files.\n"
> "See 'git help status' for information on how to improve this.")
>
> This keeps all of the information in the documentation rather
> than having part of it here in the code.
>
> Also, we should refer to the documentation via `git help` rather
> than as a link to the website.I agree with your suggestion of not linking out to git-scm.com here, but I wonder if we could get by without mentioning 'git help' here, either. Presumably looking up an unknown configuration variable with 'man git-config' is easy enough.
Thanks, Taylor