On Wed, Mar 18, 2015 at 07:00:13PM +0100, Wilhelm Schuermann wrote:
> When grep is called with the --quiet option, the pager is initialized
> despite not being used. When the pager is "less", anything output by
> previous commands and not ended with a newline is overwritten.
> [...]
> This patch prevents calling the pager in the first place, saving an
> unnecessary fork() call.
Thanks, I think this makes sense. We do a similar thing for "git diff
--quiet". If you do not set "-F" in your $LESS variable, it is even more
annoying. E.g., with:
if git grep -q foo; then
: do something
fi
which will pause, waiting for the user to hit 'q'.
> diff --git a/builtin/grep.c b/builtin/grep.c
> index e77f7cf..fe7b9fd 100644
> --- a/builtin/grep.c
> +++ b/builtin/grep.c
> @@ -885,7 +885,7 @@ int cmd_grep(int argc, const char **argv, const char
> *prefix)
> }
> }
>
> - if (!show_in_pager)
> + if (!show_in_pager && !opt.status_only)
> setup_pager();
Patch looks obviously correct.
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html