X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=pretty.c;h=0c3149524059bd46c3c6d70bd774df0aaa65f976;hb=9b0db33506ea9b1d968d719f2fce9c208c66cd95;hp=9788bd8f3f0ece03a6b87778a2d43bfaf3c14a9d;hpb=35ec7fd479f85797d3d2b76beee29121a0a45aff;p=git-core%2Fgit.git diff --git a/pretty.c b/pretty.c index 9788bd8f3..0c3149524 100644 --- a/pretty.c +++ b/pretty.c @@ -544,15 +544,13 @@ static void add_merge_info(const struct pretty_print_context *pp, strbuf_addstr(sb, "Merge:"); while (parent) { - struct commit *p = parent->item; - const char *hex = NULL; + struct object_id *oidp = &parent->item->object.oid; + strbuf_addch(sb, ' '); if (pp->abbrev) - hex = find_unique_abbrev(p->object.oid.hash, pp->abbrev); - if (!hex) - hex = oid_to_hex(&p->object.oid); + strbuf_add_unique_abbrev(sb, oidp->hash, pp->abbrev); + else + strbuf_addstr(sb, oid_to_hex(oidp)); parent = parent->next; - - strbuf_addf(sb, " %s", hex); } strbuf_addch(sb, '\n'); } @@ -1072,6 +1070,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ case 'C': if (starts_with(placeholder + 1, "(auto)")) { c->auto_color = want_color(c->pretty_ctx->color); + if (c->auto_color && sb->len) + strbuf_addstr(sb, GIT_COLOR_RESET); return 7; /* consumed 7 bytes, "C(auto)" */ } else { int ret = parse_color(sb, placeholder, c);