diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-12-17 17:56:49 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-12-17 17:30:04 -0800 |
commit | 30825178fb72e3664bd1bda7c02c62e300e2e5ce (patch) | |
tree | 299ae9907e26fca9f2090b17ca387ff8b4aba9fa /Documentation/pretty-formats.txt | |
parent | 2581ad5e85f6443b0d2cf6898793662aec47ef10 (diff) | |
download | git-30825178fb72e3664bd1bda7c02c62e300e2e5ce.tar.gz git-30825178fb72e3664bd1bda7c02c62e300e2e5ce.tar.xz |
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 'Documentation/pretty-formats.txt')
-rw-r--r-- | Documentation/pretty-formats.txt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt index d9eddedc7..105f18a6f 100644 --- a/Documentation/pretty-formats.txt +++ b/Documentation/pretty-formats.txt @@ -144,7 +144,11 @@ The placeholders are: - '%Cgreen': switch color to green - '%Cblue': switch color to blue - '%Creset': reset color -- '%C(...)': color specification, as described in color.branch.* config option +- '%C(...)': color specification, as described in color.branch.* config option; + adding `auto,` at the beginning will emit color only when colors are + 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) - '%m': left, right or boundary mark - '%n': newline - '%%': a raw '%' |