diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2016-05-26 22:46:10 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-27 11:24:54 -0700 |
commit | b15a3e005af07843116c73205742adfbab3d2e82 (patch) | |
tree | ac340c93c4cc06bf6ba73d0220f140d2f9f31240 /t/t4013 | |
parent | Git 2.8.3 (diff) | |
download | tgif-b15a3e005af07843116c73205742adfbab3d2e82.tar.xz |
format_commit_message: honor `color=auto` for `%C(auto)`
git-log(1) documents that when specifying the `%C(auto)` format
placeholder will "turn on auto coloring on the next %placeholders
until the color is switched again."
However, when `%C(auto)` is used, the present implementation will turn
colors on unconditionally (even if the color configuration is turned off
for the current context - for example, `--no-color` was specified or the
color is `auto` and the output is not a tty).
Update `format_commit_one` to examine the current context when a format
string of `%C(auto)` is specified, which ensures that we will not
unconditionally write colors. This brings that behavior in line with
the behavior of `%C(auto,<colorname>)`, and allows the user the ability
to specify that color should be displayed only when the output is a
tty.
Additionally, add a test for `%C(auto)` and update the existing tests
for `%C(auto,...)` as they were misidentified as being applicable to
`%C(auto)`.
Tests from Jeff King.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Edward Thomson <ethomson@edwardthomson.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013')
0 files changed, 0 insertions, 0 deletions