summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-17 13:25:21 -0700
committerJunio C Hamano <gitster@pobox.com>2016-10-17 13:25:21 -0700
commit69e6544998892a2bd3c785cd238c786da40cf6a3 (patch)
tree5226289723f43db878429658b27a89b4ad23ee57 /pretty.c
parent9424bf27079a1262e42a2330283f7ab6c805267a (diff)
parenta94bb683970a111b467a36590ca36e52754ad504 (diff)
downloadgit-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.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/pretty.c b/pretty.c
index 25efbcac92..0c31495240 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');
}