Subject: Re: [PATCH 1/3] for-each-ref: introduce %C(...) for color

From: Junio C Hamano <[email-masked]>
Date: Fri, 08 Nov 2013 09:30:31 -0800

Ramkumar Ramachandra <[email-masked]> writes:

> ... %C(...) is
> different in that it doesn't actually output anything, but changes the
> color of tokens following it. While I'm not opposed to %(color:...), I
> would prefer a color syntax that is different from other-token syntax,
> like in pretty-formats.

You may prefer it, but I do not see why users prefer to memorize
that a magic that consumes no display output columns uses a syntax
different from all the other magic introducers that follows %(name
of the magic with string after colon to give more specifics to the
magic) syntax.

In all honesty, the %XY mnemonic syntax in pretty-format is a
syntactic disaster.  It is perfectly OK to have a set of often used
shorthand, but because we started without a consistent long-hand, we
ended up with %Cred and %C(yellow), leading us to a nonsense like
this (try it yourself and weep):

    $ git show -s --format='%CredAnd%CyellowAreNotTheSameColor'

It would have been much saner if we started from %(color:yellow),
%(subject), etc., i.e. have a single long-hand magic introducer
%(...), and added a set of often-used short-hands like %s.

I am not opposed to unify the internal implementations and the
external interfaces of pretty, for-each-ref and friends, but
modelling the external UI after the "mnemonic only with ad hoc
additions" mess the pretty-format uses is a huge mistake.