[PATCH] describe: use strbuf_add_unique_abbrev() for adding short hashes
- From
René Scharfe <l.s.r@web.de>
- Date
- Jan 15, 2018, 17:10 UTC
- Message-ID
- <422ae05b-6541-38f3-7638-4bee1b766d91@web.de>
Call strbuf_add_unique_abbrev() to add an abbreviated hash to a strbuf instead of taking a detour through find_unique_abbrev() and its static buffer. This is shorter and a bit more efficient.
Patch generated by Coccinelle (and contrib/coccinelle/strbuf.cocci).
Signed-off-by: Rene Scharfe <l.s.r@web.de> --- The changed line was added by 4dbc59a4cc (builtin/describe.c: factor out describe_commit).
"make coccicheck" doesn't propose any other changes for current master.
builtin/describe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/describe.c b/builtin/describe.c index 3b0b204b1e..21e37f5dae 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -380,7 +380,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst) if (!match_cnt) { struct object_id *cmit_oid = &cmit->object.oid; if (always) { - strbuf_addstr(dst, find_unique_abbrev(cmit_oid->hash, abbrev)); + strbuf_add_unique_abbrev(dst, cmit_oid->hash, abbrev); if (suffix) strbuf_addstr(dst, suffix); return;
-- 2.15.1