Message ID | 20181019161228.17196-3-peartben@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2,1/3] reset: don't compute unstaged changes after reset when --quiet | expand |
On Fri, Oct 19, 2018 at 12:12 PM Ben Peart <peartben@gmail.com> wrote: > Add a reset.quiet config setting that sets the default value of the --quiet > flag when running the reset command. This enables users to change the > default behavior to take advantage of the performance advantages of > avoiding the scan for unstaged changes after reset. Defaults to false. > > Signed-off-by: Ben Peart <benpeart@microsoft.com> > --- > diff --git a/Documentation/config.txt b/Documentation/config.txt > @@ -2728,6 +2728,9 @@ rerere.enabled:: > +reset.quiet:: > + When set to true, 'git reset' will default to the '--quiet' option. How does the user reverse this for a particular git-reset invocation? There is no --no-quiet or --verbose option. Perhaps you want to use OPT__VERBOSITY() instead of OPT__QUIET() in builtin/reset.c and document that --verbose overrides --quiet and reset.quiet (or something like that).
On Fri, Oct 19, 2018 at 12:36:44PM -0400, Eric Sunshine wrote: > On Fri, Oct 19, 2018 at 12:12 PM Ben Peart <peartben@gmail.com> wrote: > > Add a reset.quiet config setting that sets the default value of the --quiet > > flag when running the reset command. This enables users to change the > > default behavior to take advantage of the performance advantages of > > avoiding the scan for unstaged changes after reset. Defaults to false. > > > > Signed-off-by: Ben Peart <benpeart@microsoft.com> > > --- > > diff --git a/Documentation/config.txt b/Documentation/config.txt > > @@ -2728,6 +2728,9 @@ rerere.enabled:: > > +reset.quiet:: > > + When set to true, 'git reset' will default to the '--quiet' option. > > How does the user reverse this for a particular git-reset invocation? > There is no --no-quiet or --verbose option. > > Perhaps you want to use OPT__VERBOSITY() instead of OPT__QUIET() in > builtin/reset.c and document that --verbose overrides --quiet and > reset.quiet (or something like that). I think OPT__QUIET() provides --no-quiet, since it's really an OPT_COUNTUP() under the hood. Saying "--no-quiet" should reset it back to 0. -Peff
On Fri, Oct 19, 2018 at 12:46 PM Jeff King <peff@peff.net> wrote: > On Fri, Oct 19, 2018 at 12:36:44PM -0400, Eric Sunshine wrote: > > How does the user reverse this for a particular git-reset invocation? > > There is no --no-quiet or --verbose option. > > > > Perhaps you want to use OPT__VERBOSITY() instead of OPT__QUIET() in > > builtin/reset.c and document that --verbose overrides --quiet and > > reset.quiet (or something like that). > > I think OPT__QUIET() provides --no-quiet, since it's really an > OPT_COUNTUP() under the hood. Saying "--no-quiet" should reset it back > to 0. Okay. In any case, --no-quiet probably ought to be mentioned alongside the "reset.quiet" option (and perhaps in git-reset.txt to as a way to reverse "reset.quiet").
On 10/19/2018 12:46 PM, Jeff King wrote: > On Fri, Oct 19, 2018 at 12:36:44PM -0400, Eric Sunshine wrote: > >> On Fri, Oct 19, 2018 at 12:12 PM Ben Peart <peartben@gmail.com> wrote: >>> Add a reset.quiet config setting that sets the default value of the --quiet >>> flag when running the reset command. This enables users to change the >>> default behavior to take advantage of the performance advantages of >>> avoiding the scan for unstaged changes after reset. Defaults to false. >>> >>> Signed-off-by: Ben Peart <benpeart@microsoft.com> >>> --- >>> diff --git a/Documentation/config.txt b/Documentation/config.txt >>> @@ -2728,6 +2728,9 @@ rerere.enabled:: >>> +reset.quiet:: >>> + When set to true, 'git reset' will default to the '--quiet' option. >> >> How does the user reverse this for a particular git-reset invocation? >> There is no --no-quiet or --verbose option. >> >> Perhaps you want to use OPT__VERBOSITY() instead of OPT__QUIET() in >> builtin/reset.c and document that --verbose overrides --quiet and >> reset.quiet (or something like that). > > I think OPT__QUIET() provides --no-quiet, since it's really an > OPT_COUNTUP() under the hood. Saying "--no-quiet" should reset it back > to 0. > Thanks Peff. That is correct as confirmed by: C:\Repos\VSO\src>git reset --no-quiet Unstaged changes after reset: M init.ps1 It took 6.74 seconds to enumerate unstaged changes after reset. You can use '--quiet' to avoid this. Set the config setting reset.quiet to true to make this the default. > -Peff >
On Fri, Oct 19, 2018 at 01:10:34PM -0400, Eric Sunshine wrote: > On Fri, Oct 19, 2018 at 12:46 PM Jeff King <peff@peff.net> wrote: > > On Fri, Oct 19, 2018 at 12:36:44PM -0400, Eric Sunshine wrote: > > > How does the user reverse this for a particular git-reset invocation? > > > There is no --no-quiet or --verbose option. > > > > > > Perhaps you want to use OPT__VERBOSITY() instead of OPT__QUIET() in > > > builtin/reset.c and document that --verbose overrides --quiet and > > > reset.quiet (or something like that). > > > > I think OPT__QUIET() provides --no-quiet, since it's really an > > OPT_COUNTUP() under the hood. Saying "--no-quiet" should reset it back > > to 0. > > Okay. In any case, --no-quiet probably ought to be mentioned alongside > the "reset.quiet" option (and perhaps in git-reset.txt to as a way to > reverse "reset.quiet"). Yes, I'd agree with that. -Peff
On 10/19/2018 1:11 PM, Jeff King wrote: > On Fri, Oct 19, 2018 at 01:10:34PM -0400, Eric Sunshine wrote: > >> On Fri, Oct 19, 2018 at 12:46 PM Jeff King <peff@peff.net> wrote: >>> On Fri, Oct 19, 2018 at 12:36:44PM -0400, Eric Sunshine wrote: >>>> How does the user reverse this for a particular git-reset invocation? >>>> There is no --no-quiet or --verbose option. >>>> >>>> Perhaps you want to use OPT__VERBOSITY() instead of OPT__QUIET() in >>>> builtin/reset.c and document that --verbose overrides --quiet and >>>> reset.quiet (or something like that). >>> >>> I think OPT__QUIET() provides --no-quiet, since it's really an >>> OPT_COUNTUP() under the hood. Saying "--no-quiet" should reset it back >>> to 0. >> >> Okay. In any case, --no-quiet probably ought to be mentioned alongside >> the "reset.quiet" option (and perhaps in git-reset.txt to as a way to >> reverse "reset.quiet"). > > Yes, I'd agree with that. > > -Peff > Makes sense. I'll update the docs to say: -q:: --quiet:: --no-quiet:: Be quiet, only report errors. + With --no-quiet report errors and unstaged changes after reset.
On Fri, Oct 19, 2018 at 01:23:06PM -0400, Ben Peart wrote: > > > Okay. In any case, --no-quiet probably ought to be mentioned alongside > > > the "reset.quiet" option (and perhaps in git-reset.txt to as a way to > > > reverse "reset.quiet"). > [...] > Makes sense. I'll update the docs to say: > > -q:: > --quiet:: > --no-quiet:: > Be quiet, only report errors. > + > With --no-quiet report errors and unstaged changes after reset. I think we should be explicit that "--no-quiet" is already the default, which makes it easy to mention the config option. Something like: -q:: --quiet:: --no-quiet:: Be quiet, only report errors. The default behavior respects the `reset.quiet` config option, or `--no-quiet` if that is not set. I don't know if we need to mention the "unstaged changes" thing. We may grow other non-error messages (or may even have some now, I didn't check). But I'm OK including it, too. -Peff
Ben Peart <peartben@gmail.com> writes: > On 10/19/2018 1:11 PM, Jeff King wrote: >> On Fri, Oct 19, 2018 at 01:10:34PM -0400, Eric Sunshine wrote: >> >>> On Fri, Oct 19, 2018 at 12:46 PM Jeff King <peff@peff.net> wrote: >>>> On Fri, Oct 19, 2018 at 12:36:44PM -0400, Eric Sunshine wrote: >>>>> How does the user reverse this for a particular git-reset invocation? >>>>> There is no --no-quiet or --verbose option. >>>>> >>>>> Perhaps you want to use OPT__VERBOSITY() instead of OPT__QUIET() in >>>>> builtin/reset.c and document that --verbose overrides --quiet and >>>>> reset.quiet (or something like that). >>>> >>>> I think OPT__QUIET() provides --no-quiet, since it's really an >>>> OPT_COUNTUP() under the hood. Saying "--no-quiet" should reset it back >>>> to 0. >>> >>> Okay. In any case, --no-quiet probably ought to be mentioned alongside >>> the "reset.quiet" option (and perhaps in git-reset.txt to as a way to >>> reverse "reset.quiet"). >> >> Yes, I'd agree with that. >> >> -Peff >> > > Makes sense. I'll update the docs to say: > > -q:: > --quiet:: > --no-quiet:: > Be quiet, only report errors. > + > With --no-quiet report errors and unstaged changes after reset. Sounds good. Thanks all.
diff --git a/Documentation/config.txt b/Documentation/config.txt index f6f4c21a54..a2d1b8b116 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -2728,6 +2728,9 @@ rerere.enabled:: `$GIT_DIR`, e.g. if "rerere" was previously used in the repository. +reset.quiet:: + When set to true, 'git reset' will default to the '--quiet' option. + include::sendemail-config.txt[] sequence.editor:: diff --git a/builtin/reset.c b/builtin/reset.c index 04f0d9b4f5..3b43aee544 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -306,6 +306,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) }; git_config(git_reset_config, NULL); + git_config_get_bool("reset.quiet", &quiet); argc = parse_options(argc, argv, prefix, options, git_reset_usage, PARSE_OPT_KEEP_DASHDASH);