use strbuf_add_unique_abbrev() for adding short hashes, part 3
Call strbuf_add_unique_abbrev() to add abbreviated hashes to strbufs instead of taking detours through find_unique_abbrev() and its static buffer. This is shorter in most cases and a bit more efficient. The changes here are not easily handled by a semantic patch because they involve removing temporary variables and deconstructing format strings for strbuf_addf(). 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
39ea59a257
commit
a94bb68397
@ -202,9 +202,9 @@ static void output_commit_title(struct merge_options *o, struct commit *commit)
|
||||
strbuf_addf(&o->obuf, "virtual %s\n",
|
||||
merge_remote_util(commit)->name);
|
||||
else {
|
||||
strbuf_addf(&o->obuf, "%s ",
|
||||
find_unique_abbrev(commit->object.oid.hash,
|
||||
DEFAULT_ABBREV));
|
||||
strbuf_add_unique_abbrev(&o->obuf, commit->object.oid.hash,
|
||||
DEFAULT_ABBREV);
|
||||
strbuf_addch(&o->obuf, ' ');
|
||||
if (parse_commit(commit) != 0)
|
||||
strbuf_addstr(&o->obuf, _("(bad commit)\n"));
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user