summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-01-21 16:50:34 -0800
committerJunio C Hamano <gitster@pobox.com>2009-01-21 16:50:34 -0800
commit35e6afd4c6bc73cba7bc279ff43b498389bf805a (patch)
tree9fb4d4137ada34fa48e2424ce56b52879a637611 /pretty.c
parenta14f15427bca9af70127f26cd3cb0fcd78c8d36f (diff)
parent2c2dc7c82cea66c5030583233c73593e0f5a8fdb (diff)
downloadgit-35e6afd4c6bc73cba7bc279ff43b498389bf805a.tar.gz
Merge branch 'jk/color-parse'
* jk/color-parse: Optimize color_parse_mem expand --pretty=format color options color: make it easier for non-config to parse color specs
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pretty.c b/pretty.c
index 421d9c5bca..cc460b5697 100644
--- a/pretty.c
+++ b/pretty.c
@@ -6,6 +6,7 @@
#include "string-list.h"
#include "mailmap.h"
#include "log-tree.h"
+#include "color.h"
static char *user_format;
@@ -554,6 +555,17 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
/* these are independent of the commit */
switch (placeholder[0]) {
case 'C':
+ if (placeholder[1] == '(') {
+ const char *end = strchr(placeholder + 2, ')');
+ char color[COLOR_MAXLEN];
+ if (!end)
+ return 0;
+ color_parse_mem(placeholder + 2,
+ end - (placeholder + 2),
+ "--pretty format", color);
+ strbuf_addstr(sb, color);
+ return end - placeholder + 1;
+ }
if (!prefixcmp(placeholder + 1, "red")) {
strbuf_addstr(sb, "\033[31m");
return 4;