git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: pclouds@gmail.com
Cc: git@vger.kernel.org, gitster@pobox.com, thiago.salves@gmail.com
Subject: Re: [PATCH] grep: prefer builtin over external one when coloring results
Date: Mon, 16 Mar 2009 18:31:17 +0100	[thread overview]
Message-ID: <49BE8CE5.2020603@lsrfire.ath.cx> (raw)
In-Reply-To: <1237170004-27768-1-git-send-email-pclouds@gmail.com>

pclouds@gmail.com schrieb:
> As far as I know, not all grep programs support coloring, so we should
> rely on builtin grep. If you want external grep, set
> color.grep.external to empty string.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  How about this?
> 
>  builtin-grep.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/builtin-grep.c b/builtin-grep.c
> index 9e7e766..89489dd 100644
> --- a/builtin-grep.c
> +++ b/builtin-grep.c
> @@ -825,6 +825,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
>  		}
>  	}
>  
> +	if (opt.color && !opt.color_external)
> +		builtin_grep = 1;
>  	if (!opt.pattern_list)
>  		die("no pattern given.");
>  	if ((opt.regflags != REG_NEWLINE) && opt.fixed)

Makes sense, thanks!

René

      reply	other threads:[~2009-03-16 17:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-07 12:24 [PATCH 0/5] grep: color search patterns René Scharfe
2009-03-07 12:27 ` [PATCH 1/5] grep: micro-optimize hit collection for AND nodes René Scharfe
2009-03-07 12:28 ` [PATCH 2/5] grep: remove grep_opt argument from match_expr_eval() René Scharfe
2009-03-07 12:30 ` [PATCH 3/5] grep: add pmatch and eflags arguments to match_one_pattern() René Scharfe
2009-03-07 12:32 ` [PATCH 4/5] grep: color patterns in output René Scharfe
2009-03-07 12:34 ` [PATCH 5/5] grep: add support for coloring with external greps René Scharfe
2009-03-10  6:01 ` [PATCH 0/5] grep: color search patterns Nguyen Thai Ngoc Duy
2009-03-10 16:38   ` René Scharfe
2009-03-16  2:20     ` [PATCH] grep: prefer builtin over external one when coloring results pclouds
2009-03-16 17:31       ` René Scharfe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49BE8CE5.2020603@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=thiago.salves@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).