X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-show-branch.c;h=07a0c2316bec4dd8341ea494b02874a1b12483cd;hb=18f7c51cf921f7db021e012499456120f3f095a9;hp=4fa87f6081f74fa667a415038ca64c5f4a7cf775;hpb=b941ffac506d3f57246e46a8913da614e62a1d48;p=git.git diff --git a/builtin-show-branch.c b/builtin-show-branch.c index 4fa87f608..07a0c2316 100644 --- a/builtin-show-branch.c +++ b/builtin-show-branch.c @@ -259,16 +259,15 @@ static void join_revs(struct commit_list **list_p, static void show_one_commit(struct commit *commit, int no_name) { - char *pretty = NULL; + struct strbuf pretty; const char *pretty_str = "(unavailable)"; - unsigned long pretty_len = 0; struct commit_name *name = commit->util; + strbuf_init(&pretty, 0); if (commit->object.parsed) { - pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0, - &pretty, &pretty_len, - 0, NULL, NULL, 0); - pretty_str = pretty; + pretty_print_commit(CMIT_FMT_ONELINE, commit, + &pretty, 0, NULL, NULL, 0); + pretty_str = pretty.buf; } if (!prefixcmp(pretty_str, "[PATCH] ")) pretty_str += 8; @@ -289,7 +288,7 @@ static void show_one_commit(struct commit *commit, int no_name) find_unique_abbrev(commit->object.sha1, 7)); } puts(pretty_str); - free(pretty); + strbuf_release(&pretty); } static char *ref_name[MAX_REVS + 1];