revision.c: use commit-slab for show_source

Instead of relying on commit->util to store the source string, let the
user provide a commit-slab to store the source strings in.

It's done so that commit->util can be removed. See more explanation in
the commit that removes commit->util.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2018-05-19 07:28:24 +02:00
committed by Junio C Hamano
parent 3cc0287b39
commit 87be252333
5 changed files with 39 additions and 14 deletions

View File

@ -295,8 +295,12 @@ void show_decorations(struct rev_info *opt, struct commit *commit)
{
struct strbuf sb = STRBUF_INIT;
if (opt->show_source && commit->util)
fprintf(opt->diffopt.file, "\t%s", (char *) commit->util);
if (opt->sources) {
char **slot = revision_sources_peek(opt->sources, commit);
if (slot && *slot)
fprintf(opt->diffopt.file, "\t%s", *slot);
}
if (!opt->show_decorations)
return;
format_decorations(&sb, commit, opt->diffopt.use_color);