X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=pretty.c;h=cc460b56970c3869e67feb816f76f4804e37e7ce;hb=e5f5050ed1481c3bc27658f625a87155aed0984f;hp=343dca556cc73031bb073b6ebf8bf511db3a60c4;hpb=4f8b8992ef0c009822cdca18d32ddf3a124ee284;p=git.git diff --git a/pretty.c b/pretty.c index 343dca556..cc460b569 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; @@ -486,8 +487,8 @@ static void parse_commit_header(struct format_commit_context *context) 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 @@ 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;