From c002922adce90b69ac56a86eeb77b249afa88eb2 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 17 Jan 2009 10:38:46 -0500 Subject: expand --pretty=format color options Currently, the only colors available to --pretty=format users are red, green, and blue. Rather than expand it with a few new colors, this patch makes the usual config color syntax available, including more colors, backgrounds, and attributes. Because colors are no longer bounded to a single word (e.g., %Cred), this uses a more advanced syntax that features a beginning and end delimiter (but the old syntax still works). So you can now do: git log --pretty=tformat:'%C(yellow)%h%C(reset) %s' to emulate --pretty=oneline, or even git log --pretty=tformat:'%C(cyan magenta bold)%s%C(reset)' if you want to relive the awesomeness of 4-color CGA. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t6006-rev-list-format.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 't/t6006-rev-list-format.sh') diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index 86bf7e14ba..59d1f6283b 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -14,7 +14,7 @@ touch foo && git add foo && git commit -m "added foo" && test_format() { cat >expect.$1 test_expect_success "format $1" " -git rev-list --pretty=format:$2 master >output.$1 && +git rev-list --pretty=format:'$2' master >output.$1 && test_cmp expect.$1 output.$1 " } @@ -101,6 +101,13 @@ commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873 foobarbazxyzzy EOF +test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<'EOF' +commit 131a310eb913d107dd3c09a65d1651175898735d +foo +commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873 +foo +EOF + cat >commit-msg <<'EOF' Test printing of complex bodies -- cgit v1.2.1