summaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-12-17 22:56:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-12-18 01:30:04 (GMT)
commit30825178fb72e3664bd1bda7c02c62e300e2e5ce (patch)
tree299ae9907e26fca9f2090b17ca387ff8b4aba9fa /log-tree.c
parent2581ad5e85f6443b0d2cf6898793662aec47ef10 (diff)
downloadgit-30825178fb72e3664bd1bda7c02c62e300e2e5ce.zip
git-30825178fb72e3664bd1bda7c02c62e300e2e5ce.tar.gz
git-30825178fb72e3664bd1bda7c02c62e300e2e5ce.tar.bz2
log --format: teach %C(auto,black) to respect color config
Traditionally, %C(color attr) always emitted the ANSI color sequence; it was up to the scripts that wanted to conditionally color their output to omit %C(...) specifier when they do not want colors. Optionally allow "auto," to be prefixed to the color, so that the output is colored iff we would color regular "log" output (e.g., taking into account color.* and --color command line options). Tests and pretty_context bits by Jeff King <peff@peff.net>. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/log-tree.c b/log-tree.c
index c894930..7185bd6 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -660,6 +660,7 @@ void show_log(struct rev_info *opt)
ctx.preserve_subject = opt->preserve_subject;
ctx.reflog_info = opt->reflog_info;
ctx.fmt = opt->commit_format;
+ ctx.color = opt->diffopt.use_color;
pretty_print_commit(&ctx, commit, &msgbuf);
if (opt->add_signoff)