diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-10-17 13:25:21 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-17 13:25:21 -0700 |
commit | 69e6544998892a2bd3c785cd238c786da40cf6a3 (patch) | |
tree | 5226289723f43db878429658b27a89b4ad23ee57 /pretty.c | |
parent | 9424bf27079a1262e42a2330283f7ab6c805267a (diff) | |
parent | a94bb683970a111b467a36590ca36e52754ad504 (diff) | |
download | git-69e6544998892a2bd3c785cd238c786da40cf6a3.tar.gz |
Merge branch 'rs/cocci'
Code cleanup.
* rs/cocci:
use strbuf_add_unique_abbrev() for adding short hashes, part 3
remove unnecessary NULL check before free(3)
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -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'); } |