diff options
author | Jeff King <peff@peff.net> | 2017-07-13 17:07:30 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-07-13 21:42:51 +0200 |
commit | d75dfb1089d471501f6042341bed647525f6e293 (patch) | |
tree | d5a3a8a8816152fb24ebe31328f19d1d5d2e949c /t | |
parent | for-each-ref: load config earlier (diff) | |
download | git-d75dfb1089d471501f6042341bed647525f6e293.tar.xz git-d75dfb1089d471501f6042341bed647525f6e293.zip |
rev-list: pass diffopt->use_colors through to pretty-print
When rev-list pretty-prints a commit, it creates a new
pretty_print_context and copies items from the rev_info
struct. We don't currently copy the "use_color" field,
though. Nobody seems to have noticed because the only part
of pretty.c that cares is the %C(auto,...) placeholder, and
presumably not many people use that with the rev-list
plumbing (as opposed to with git-log).
It will become more noticeable in a future patch, though,
when we start treating all user-format colors as auto-colors
(in which case it would become impossible to format colors
with rev-list, even with --color=always).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t6006-rev-list-format.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index 647218b4ef..7b97a90bae 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -245,6 +245,17 @@ test_expect_success '%C(auto) respects --no-color' ' test_cmp expect actual ' +test_expect_success 'rev-list %C(auto,...) respects --color' ' + git rev-list --color --format="%C(auto,green)foo%C(auto,reset)" \ + -1 HEAD >actual.raw && + test_decode_color <actual.raw >actual && + cat >expect <<-EOF && + commit $(git rev-parse HEAD) + <GREEN>foo<RESET> + EOF + test_cmp expect actual +' + iconv -f utf-8 -t $test_encoding > commit-msg <<EOF Test printing of complex bodies |