From: Junio C Hamano Date: Thu, 22 Jan 2009 00:50:34 +0000 (-0800) Subject: Merge branch 'jk/color-parse' X-Git-Tag: v1.6.2-rc0~109 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/35e6afd4c6bc73cba7bc279ff43b498389bf805a?hp=-c 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 --- 35e6afd4c6bc73cba7bc279ff43b498389bf805a diff --combined pretty.c index 421d9c5bca,b1b86202e1..cc460b5697 --- a/pretty.c +++ b/pretty.c @@@ -6,6 -6,7 +6,7 @@@ #include "string-list.h" #include "mailmap.h" #include "log-tree.h" + #include "color.h" static char *user_format; @@@ -486,8 -487,8 +487,8 @@@ static void parse_commit_header(struct context->commit_header_parsed = 1; } -static const char *format_subject(struct strbuf *sb, const char *msg, - const char *line_separator) +const char *format_subject(struct strbuf *sb, const char *msg, + const char *line_separator) { int first = 1; @@@ -554,6 -555,17 +555,17 @@@ static size_t format_commit_item(struc /* 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;