diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-08-12 19:47:37 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-08-12 19:47:37 +0300 |
commit | 0a315befa7cb3132ab2ee6caa7dccb2299b7a348 (patch) | |
tree | 21d74d49b997d990b7d5067dbf840490cbaa750a /pretty.c | |
parent | 57734b4e88c4d61329c74f5f4fb042f7de622966 (diff) | |
parent | 1eb47f167d65d1d305b9c196a1bb40eb96117cb1 (diff) |
Merge branch 'rs/use-strbuf-add-unique-abbrev'
A small code clean-up.
* rs/use-strbuf-add-unique-abbrev:
use strbuf_add_unique_abbrev() for adding short hashes
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1143,8 +1143,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET)); return 1; } - strbuf_addstr(sb, find_unique_abbrev(commit->object.oid.hash, - c->pretty_ctx->abbrev)); + strbuf_add_unique_abbrev(sb, commit->object.oid.hash, + c->pretty_ctx->abbrev); strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET)); c->abbrev_commit_hash.len = sb->len - c->abbrev_commit_hash.off; return 1; @@ -1154,8 +1154,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ case 't': /* abbreviated tree hash */ if (add_again(sb, &c->abbrev_tree_hash)) return 1; - strbuf_addstr(sb, find_unique_abbrev(commit->tree->object.oid.hash, - c->pretty_ctx->abbrev)); + strbuf_add_unique_abbrev(sb, commit->tree->object.oid.hash, + c->pretty_ctx->abbrev); c->abbrev_tree_hash.len = sb->len - c->abbrev_tree_hash.off; return 1; case 'P': /* parent hashes */ @@ -1171,9 +1171,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ for (p = commit->parents; p; p = p->next) { if (p != commit->parents) strbuf_addch(sb, ' '); - strbuf_addstr(sb, find_unique_abbrev( - p->item->object.oid.hash, - c->pretty_ctx->abbrev)); + strbuf_add_unique_abbrev(sb, p->item->object.oid.hash, + c->pretty_ctx->abbrev); } c->abbrev_parent_hashes.len = sb->len - c->abbrev_parent_hashes.off; |