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, 0);
- pretty_str = pretty;
+ pretty_print_commit(CMIT_FMT_ONELINE, commit,
+ &pretty, 0, NULL, NULL, 0, 0);
+ pretty_str = pretty.buf;
}
if (!prefixcmp(pretty_str, "[PATCH] "))
pretty_str += 8;
find_unique_abbrev(commit->object.sha1, 7));
}
puts(pretty_str);
- free(pretty);
+ strbuf_release(&pretty);
}
static char *ref_name[MAX_REVS + 1];