* rfe: git-config: lack of color reset option
@ 2012-02-20 20:50 Jan Engelhardt
2012-02-20 21:20 ` Jeff King
0 siblings, 1 reply; 3+ messages in thread
From: Jan Engelhardt @ 2012-02-20 20:50 UTC (permalink / raw)
To: git
Hi,
given the following config:
[color "diff"]
commit = bold white blue
[color "decorate"]
branch = green
The attributes from color.diff.commit are inherited for color.decorate.
1. There seems to be no way to reset the attributes such that
"color.decorate.branch = default green blue" wouuld have an effect.
2. It would be nice if there was an option to only paint the
commit hash, rather than the entire line including the decorate
parenthesis group.
(My current version is 1.7.7, but there seem to be no changes regarding
color config in 1.7.8 and 1.7.9 in the release notes, so I presume the
issue is still current.)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: rfe: git-config: lack of color reset option
2012-02-20 20:50 rfe: git-config: lack of color reset option Jan Engelhardt
@ 2012-02-20 21:20 ` Jeff King
2012-02-20 22:05 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2012-02-20 21:20 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: git
On Mon, Feb 20, 2012 at 09:50:11PM +0100, Jan Engelhardt wrote:
> given the following config:
>
> [color "diff"]
> commit = bold white blue
> [color "decorate"]
> branch = green
>
> The attributes from color.diff.commit are inherited for color.decorate.
This is an artifact of the way the ANSI colorizing works. Git says "turn
on bold white and a blue background", then it outputs some content, then
it says "turn on green", and so forth. At the end we issue a "reset" to
turn everything back to normal. We should perhaps issue a reset before
outputting the decoration, as we are moving from one colorized bit to
the other, and we don't know what we are inheriting.
Of course that would break people who _want_ the blue background to
continue into the branch decoration. But they can easily fix it by
putting "green blue" in their config.
> 1. There seems to be no way to reset the attributes such that
> "color.decorate.branch = default green blue" wouuld have an effect.
I would have expected that perhaps setting color.decorate.branch to
"reset green" would work, but it seems that we don't allow arbitrary
sequences. Which would be another possible solution.
In your case, I think you just want turn off bold without resetting the
whole thing. That is its own attribute. It would be nice if we supported
"nobold", "noreverse", etc. But you wouldn't really need them if we
properly reset at the transition between two colorized bits.
> 2. It would be nice if there was an option to only paint the
> commit hash, rather than the entire line including the decorate
> parenthesis group.
Yeah, the parentheses are explicitly painted. I'm not sure how to easily
fix that short of adding lots of painfully small config options.
I have a long term dream that our --pretty=format specifiers would grow
featureful enough that all of the other --pretty formats could be
implemented in terms of them. And then you could tweak to your hearts
content, starting with the embedded definition of what "git log" shows
and putting colors wherever you like. I'm not sure how far we are off
from doing that now. You could try writing a format-specifier that looks
like git-log output and see if there is anything lacking.
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: rfe: git-config: lack of color reset option
2012-02-20 21:20 ` Jeff King
@ 2012-02-20 22:05 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2012-02-20 22:05 UTC (permalink / raw)
To: Jeff King; +Cc: Jan Engelhardt, git
Jeff King <peff@peff.net> writes:
> This is an artifact of the way the ANSI colorizing works. Git says "turn
> on bold white and a blue background", then it outputs some content, then
> it says "turn on green", and so forth. At the end we issue a "reset" to
> turn everything back to normal. We should perhaps issue a reset before
> outputting the decoration, as we are moving from one colorized bit to
> the other, and we don't know what we are inheriting.
Yeah, I agree with the diagnosis and the proposed solution. It sounds
both simple and correct thing to do.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-20 22:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-20 20:50 rfe: git-config: lack of color reset option Jan Engelhardt
2012-02-20 21:20 ` Jeff King
2012-02-20 22:05 ` Junio C Hamano
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).