From fbac558a9bde48fa23b9c536357ab17c71b4bd22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Mon, 15 Jan 2018 18:10:32 +0100 Subject: describe: use strbuf_add_unique_abbrev() for adding short hashes 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 Signed-off-by: Junio C Hamano --- builtin/describe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') 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; -- cgit v1.2.3