{"thread":{"id":"42442","subject":"[PATCH] format_commit_message: honor `color=auto` for `%C(auto)`","startedAt":"2016-05-24T19:48:14Z","lastAt":"2016-05-25T01:26:52Z","messageCount":3,"participants":["Edward Thomson","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"287451","messageId":"20160524194814.GA12479@zoidberg","threadId":"42442","inReplyTo":null,"subject":"[PATCH] format_commit_message: honor `color=auto` for `%C(auto)`","fromName":"Edward Thomson","fromEmail":"ethomson@edwardthomson.com","sentAt":"2016-05-24T19:48:14Z","receivedAt":"2016-05-24T19:48:14Z","isPatch":true,"sender":{"key":"ethomson@edwardthomson.com","avatar":"https://avatars.githubusercontent.com/u/1130014?v=4"},"body":"Check that we are configured to display colors in the given context when\nthe user specifies a format string of `%C(auto)`, instead of always\ndisplaying the default color for the given context.  This makes\n`%C(auto)` obey the `color=auto` setting and brings its behavior in line\nwith the behavior of `%C(auto,<colorname>)`.\n\nThis allows the user the ability to specify that color should be\ndisplayed for a string only when the output is a tty, and to use the\ndefault color for the given context without having to hardcode a\ncolor value.\n---\n pretty.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex 87c4497..c3ec430 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1063,7 +1063,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */\n \tswitch (placeholder[0]) {\n \tcase 'C':\n \t\tif (starts_with(placeholder + 1, \"(auto)\")) {\n-\t\t\tc->auto_color = 1;\n+\t\t\tc->auto_color = want_color(c->pretty_ctx->color);\n \t\t\treturn 7; /* consumed 7 bytes, \"C(auto)\" */\n \t\t} else {\n \t\t\tint ret = parse_color(sb, placeholder, c);\n-- \n2.6.4 (Apple Git-63)\n"},{"id":"287469","messageId":"CAPc5daV4Z0gvaOL1H-v-G7RepGyiuir_AnzNx32aM3j2pm0RGw@mail.gmail.com","threadId":"42442","inReplyTo":"20160524194814.GA12479@zoidberg","subject":"Re: [PATCH] format_commit_message: honor `color=auto` for `%C(auto)`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-25T00:55:02Z","receivedAt":"2016-05-25T00:55:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"On Tue, May 24, 2016 at 12:48 PM, Edward Thomson\n<ethomson@edwardthomson.com> wrote:\n> Check that we are configured to display colors in the given context when\n> the user specifies a format string of `%C(auto)`, instead of always\n> displaying the default color for the given context.  This makes\n> `%C(auto)` obey the `color=auto` setting and brings its behavior in line\n> with the behavior of `%C(auto,<colorname>)`.\n>\n> This allows the user the ability to specify that color should be\n> displayed for a string only when the output is a tty, and to use the\n> default color for the given context without having to hardcode a\n> color value.\n> ---\n>  pretty.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n\nLooks obviously the right thing to do from a cursory read.\nMissing sign-off?\n\nThanks.\n"},{"id":"287471","messageId":"20160525012652.GA13168@zoidberg","threadId":"42442","inReplyTo":"CAPc5daV4Z0gvaOL1H-v-G7RepGyiuir_AnzNx32aM3j2pm0RGw@mail.gmail.com","subject":"Re: [PATCH] format_commit_message: honor `color=auto` for `%C(auto)`","fromName":"Edward Thomson","fromEmail":"ethomson@edwardthomson.com","sentAt":"2016-05-25T01:26:52Z","receivedAt":"2016-05-25T01:26:52Z","isPatch":true,"sender":{"key":"ethomson@edwardthomson.com","avatar":"https://avatars.githubusercontent.com/u/1130014?v=4"},"body":"On Tue, May 24, 2016 at 05:55:02PM -0700, Junio C Hamano wrote:\n> Looks obviously the right thing to do from a cursory read.\n> Missing sign-off?\n\nYes, apologies for the oversight; will re-send.\n\nThanks-\n-ed\n"}]}