X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=pretty.c;h=428fbb61a331c667b52b1ad6f26c3765f951b6b9;hb=7fcda9201e192413c2e63fe35ce6664dbc81705d;hp=421d9c5bca2224777808ccc06fe4912ba8793229;hpb=90b23e5f21e101f14da60375e4bda265a677e209;p=git.git diff --git a/pretty.c b/pretty.c index 421d9c5bc..428fbb61a 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; @@ -209,15 +210,13 @@ static void add_merge_info(enum cmit_fmt fmt, struct strbuf *sb, while (parent) { struct commit *p = parent->item; const char *hex = NULL; - const char *dots; if (abbrev) hex = find_unique_abbrev(p->object.sha1, abbrev); if (!hex) hex = sha1_to_hex(p->object.sha1); - dots = (abbrev && strlen(hex) != 40) ? "..." : ""; parent = parent->next; - strbuf_addf(sb, " %s%s", hex, dots); + strbuf_addf(sb, " %s", hex); } strbuf_addch(sb, '\n'); } @@ -554,6 +553,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;