git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Mark Lodato <lodatom@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCHv2 2/3] grep: Colorize filename, line number, and separator
Date: Sun, 07 Mar 2010 11:02:02 -0800	[thread overview]
Message-ID: <7v1vfwrm51.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1267980767-12617-3-git-send-email-lodatom@gmail.com> (Mark Lodato's message of "Sun\,  7 Mar 2010 11\:52\:46 -0500")

Mark Lodato <lodatom@gmail.com> writes:

> +	if (color) {
>  		if (!value)
>  			return config_error_nonbool(var);
> -		color_parse(value, var, opt->color_match);
> -		return 0;
> +		color_parse(value, var, color);
> +		if (!strcmp(color, GIT_COLOR_RESET))
> +			color[0] = '\0';

I don't know this "optimization" is warranted.  I can understand that you
are trying to help the user to save a handful of useless bytes per line of
output in the normal case, but doesn't "color.cmd.foo = normal" set the
value to an empty string already if that is what the user wants?

The user may know about his contents better than this code does; perhaps
the payload sometimes has funny ANSI sequence in it and the user may be
trying to explicitly reset at the beginning of the line for the "plain"
part of the output by saying "reset".  Wouldn't this make it impossible to
do so?

  reply	other threads:[~2010-03-07 19:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-07 16:52 [PATCHv2 0/3] grep color enhancements Mark Lodato
2010-03-07 16:52 ` [PATCHv2 1/3] Add GIT_COLOR_BOLD_* and GIT_COLOR_BG_* Mark Lodato
2010-03-07 16:52 ` [PATCHv2 2/3] grep: Colorize filename, line number, and separator Mark Lodato
2010-03-07 19:02   ` Junio C Hamano [this message]
2010-03-07 20:47     ` Mark Lodato
2010-03-07 16:52 ` [PATCHv2 3/3] grep: Colorize selected, context, and function lines Mark Lodato

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=7v1vfwrm51.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=lodatom@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).