Skip to content

Commit fbac558

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0c37383 commit fbac558

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/describe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
380380
if (!match_cnt) {
381381
struct object_id *cmit_oid = &cmit->object.oid;
382382
if (always) {
383-
strbuf_addstr(dst, find_unique_abbrev(cmit_oid->hash, abbrev));
383+
strbuf_add_unique_abbrev(dst, cmit_oid->hash, abbrev);
384384
if (suffix)
385385
strbuf_addstr(dst, suffix);
386386
return;

0 commit comments

Comments
 (0)