From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] log --decorate: do not leak "commit" color into the next item
Date: Wed, 18 Feb 2015 18:07:29 -0500 [thread overview]
Message-ID: <20150218230728.GA17302@peff.net> (raw)
In-Reply-To: <xmqqpp9628tl.fsf@gitster.dls.corp.google.com>
On Wed, Feb 18, 2015 at 01:44:54PM -0800, Junio C Hamano wrote:
> If you wanted to paint the HEAD and local branch name in the same
> color as the body text (perhaps because cyan and green are too faint
> on a black-on-white terminal to be readable), you would not want to
> have to say
>
> [color "decorate"]
> head = black
> branch = black
>
> because that you would not be able to reuse same configuration on a
> white-on-black terminal. You would naively expect
>
> [color "decorate"]
> head = normal
> branch = normal
>
> to work, but unfortunately it does not. It paints the string "HEAD"
> and the branch name in the same color as the opening parenthesis or
> comma between the decoration elements when showing output like this:
>
> $ git show -s --decorate
> commit f3f407747c1cce420ae4b4857c4a6806efe38680 (HEAD, master)
> ...
>
> This is because the code forgets to reset the color after printing
> the "prefix" in its own color.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
Yeah, I think this is a good fix. I had a vague feeling that we may have
done this on purpose to let the decoration color "inherit" from the
existing colors for backwards compatibility, but I don't think that
could ever have worked (since color.decorate.* never defaulted to
"normal"). And I couldn't find anything on the list. I think I am
probably thinking of color.diff.func, which faced a similar issue.
Also, for your amusement:
http://thread.gmane.org/gmane.comp.version-control.git/191102/focus=191118
Believe it or not, this was actually an item on my todo list, which is
perhaps a commentary on how sad and unrealistic my todo list is. But I'm
crossing it off anyway. Task accomplished!
-Peff
next prev parent reply other threads:[~2015-02-18 23:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-18 21:03 [Q] should "color.*.<slot> = normal" emit nothing? Junio C Hamano
2015-02-18 21:44 ` [PATCH] log --decorate: do not leak "commit" color into the next item Junio C Hamano
2015-02-18 23:07 ` Jeff King [this message]
2015-02-19 18:02 ` Junio C Hamano
2015-02-20 1:42 ` Jeff King
2015-02-20 23:06 ` Junio C Hamano
2015-02-21 6:23 ` Jeff King
2015-02-21 7:09 ` Junio C Hamano
2015-03-04 21:33 ` [PATCH v2 0/7] Fix leak of color/attributes in "git log --decorate" Junio C Hamano
2015-03-04 21:33 ` [PATCH v2 1/7] Documentation/config.txt: avoid unnecessary negation Junio C Hamano
2015-03-04 21:33 ` [PATCH v2 2/7] Documentation/config.txt: explain multi-valued variables once Junio C Hamano
2015-03-04 21:33 ` [PATCH v2 3/7] Documentation/config.txt: describe the structure first and then meaning Junio C Hamano
2015-03-04 21:33 ` [PATCH v2 4/7] Documentation/config.txt: have a separate "Values" section Junio C Hamano
2015-03-04 21:33 ` [PATCH v2 5/7] Documentation/config.txt: describe 'color' value type in the " Junio C Hamano
2015-03-04 21:33 ` [PATCH v2 6/7] Documentation/config.txt: simplify boolean description in the syntax section Junio C Hamano
2015-03-04 21:33 ` [PATCH v2 7/7] log --decorate: do not leak "commit" color into the next item Junio C Hamano
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=20150218230728.GA17302@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).