Re: [PATCH] pretty: respect color settings for %C placeholders

2016-10-11 Thread Duy Nguyen
On Mon, Oct 10, 2016 at 10:15 PM, Jeff King wrote: > On Mon, Oct 10, 2016 at 10:28:18AM -0400, Jeff King wrote: > >> > We could add some new tag to change the behavior of all following %C >> > tags. Something like %C(tty) maybe (probably a bad name), then >> > discourage the use if

Re: [PATCH] pretty: respect color settings for %C placeholders

2016-10-10 Thread Jeff King
On Mon, Oct 10, 2016 at 02:59:35PM -0400, Jeff King wrote: > > I must be reading the patch incorrectly, but I cannot quite tell > > where I want astray... > > No, we don't come here from %C() at all. This is for bare "%Cred", which > cannot have "always" (or "auto"), as there is no syntactic

Re: [PATCH] pretty: respect color settings for %C placeholders

2016-10-10 Thread Jeff King
On Mon, Oct 10, 2016 at 09:59:17PM +0200, René Scharfe wrote: > > > Shouldn't we have an "else" here? > > > > I'm not sure what you mean; can you write it out? > > > - if (skip_prefix(begin, "auto,", )) { > > + > > + if (!skip_prefix(begin, "always,", )) { > >

Re: [PATCH] pretty: respect color settings for %C placeholders

2016-10-10 Thread René Scharfe
Am 10.10.2016 um 19:42 schrieb Jeff King: On Mon, Oct 10, 2016 at 07:09:12PM +0200, René Scharfe wrote: diff --git a/pretty.c b/pretty.c index 25efbca..73e58b5 100644 --- a/pretty.c +++ b/pretty.c @@ -965,22 +965,31 @@ static size_t parse_color(struct strbuf *sb, /* in UTF-8 */

Re: [PATCH] pretty: respect color settings for %C placeholders

2016-10-10 Thread Jeff King
On Mon, Oct 10, 2016 at 11:52:14AM -0700, Junio C Hamano wrote: > > + By default, colors are shown only when enabled for log output (by > > + `color.diff`, `color.ui`, or `--color`, and respecting the `auto` > > + settings of the former if we are going to a terminal). `%C(auto,...)` > > + is

Re: [PATCH] pretty: respect color settings for %C placeholders

2016-10-10 Thread Junio C Hamano
Jeff King writes: > So here's what a patch to do that would look like. I admit that "I can't > think of a good use" does not mean there _isn't_ one, but perhaps by > posting this, it might provoke other people to think on it, too. And if > nobody can come up with, maybe it's a

Re: [PATCH] pretty: respect color settings for %C placeholders

2016-10-10 Thread Jeff King
On Mon, Oct 10, 2016 at 07:09:12PM +0200, René Scharfe wrote: > > diff --git a/pretty.c b/pretty.c > > index 25efbca..73e58b5 100644 > > --- a/pretty.c > > +++ b/pretty.c > > @@ -965,22 +965,31 @@ static size_t parse_color(struct strbuf *sb, /* in > > UTF-8 */ > > > > if (!end) > >

Re: [PATCH] pretty: respect color settings for %C placeholders

2016-10-10 Thread René Scharfe
Am 10.10.2016 um 17:15 schrieb Jeff King: On Mon, Oct 10, 2016 at 10:28:18AM -0400, Jeff King wrote: We could add some new tag to change the behavior of all following %C tags. Something like %C(tty) maybe (probably a bad name), then discourage the use if "%C(auto" for terminal detection?