From: Edward Thomson <ethomson@edwardthomson.com>
To: git@vger.kernel.org
Subject: [PATCH] format_commit_message: honor `color=auto` for `%C(auto)`
Date: Tue, 24 May 2016 20:56:49 -0500 [thread overview]
Message-ID: <20160525015649.GA13258@zoidberg> (raw)
Check that we are configured to display colors in the given context when
the user specifies a format string of `%C(auto)`. This brings that
behavior in line with the behavior of `%C(auto,<colorname>)`, which will
display the given color only when the configuration specifies to do so.
This allows the user the ability to specify that color should be
displayed only when the output is a tty, and to use the default color
for the given context (instead of a hardcoded color value).
Signed-off-by: Edward Thomson <ethomson@edwardthomson.com>
---
pretty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pretty.c b/pretty.c
index 87c4497..c3ec430 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1063,7 +1063,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
switch (placeholder[0]) {
case 'C':
if (starts_with(placeholder + 1, "(auto)")) {
- c->auto_color = 1;
+ c->auto_color = want_color(c->pretty_ctx->color);
return 7; /* consumed 7 bytes, "C(auto)" */
} else {
int ret = parse_color(sb, placeholder, c);
--
2.6.4 (Apple Git-63)
next reply other threads:[~2016-05-25 1:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-25 1:56 Edward Thomson [this message]
2016-05-25 22:39 ` [PATCH] format_commit_message: honor `color=auto` for `%C(auto)` Jeff King
2016-05-27 3:47 ` Edward Thomson
2016-05-31 12:23 ` Duy Nguyen
2016-05-31 22:18 ` Jeff King
-- strict thread matches above, loose matches on Subject: below --
2016-05-27 3:46 Edward Thomson
2016-05-27 3:55 ` Jeff King
2016-05-27 6:22 ` Junio C Hamano
2016-05-24 19:48 Edward Thomson
2016-05-25 0:55 ` Junio C Hamano
2016-05-25 1:26 ` Edward Thomson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160525015649.GA13258@zoidberg \
--to=ethomson@edwardthomson.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).