Re: [PATCH] document behavior of empty color name
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 3, 2017, 18:12 UTC
- Message-ID
- <xmqqy3xnf8jm.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170203122859.753bexioxxkibfzb@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 19 quoted lines
> On Fri, Feb 03, 2017 at 04:24:30PM +0700, Duy Nguyen wrote:
>
>> > I don't think so. The default value is a git-config thing, but you would
>> > want to be able to do the same thing in a config file. For example, to
>> > disable coloring entirely for part of the diff, you could do:
>> >
>> > [color "diff"]
>> > meta = ""
>>
>> OK but it makes log.graphColors add empty colors though. In t4202.39,
>> we have " blue,invalid-color, cyan, red , ". With this patch the color
>> after red would be no color. Without it, we get a complaint and the
>> next color would be cycled back to blue. The test does not catch this
>> because the test graph does not have enough fork points to get to red
>> and back to blue.
>
> Right, I think that's the correct behavior. The empty color name is a
> real color ("none"), and you can put it in your list just like any other
> color.Makes me wonder if we have a non-empty string that spells the same "do nothing", because ...
Show 6 quoted lines
> It's possible that somebody would like to use the sort of "hanging > comma" behavior that people do with lists that might be added to later > (e.g., for enums in C). > > IMHO that would be best handled by having the list-parsing code drop > trailing empty entries.
... I agree with this position 100%, and while I have a suspicion that real people do not necessarily want the "hanging comma" behaviour, we would need a way to spell "I want a do-nothing color at the end of this list, this is not a hanging comma" for completeness, if we start supporting "hanging comma".
The above is just me "wondering"; I do not think what we have needs further tweaks--an empty after the final comma that means "do-nothing" is fine, I would think.
Thanks.