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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0c37383f2e
commit
fbac558a9b
@ -380,7 +380,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
|
|||||||
if (!match_cnt) {
|
if (!match_cnt) {
|
||||||
struct object_id *cmit_oid = &cmit->object.oid;
|
struct object_id *cmit_oid = &cmit->object.oid;
|
||||||
if (always) {
|
if (always) {
|
||||||
strbuf_addstr(dst, find_unique_abbrev(cmit_oid->hash, abbrev));
|
strbuf_add_unique_abbrev(dst, cmit_oid->hash, abbrev);
|
||||||
if (suffix)
|
if (suffix)
|
||||||
strbuf_addstr(dst, suffix);
|
strbuf_addstr(dst, suffix);
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user