cocci: apply the "pretty.h" part of "the_repository.pending"

Apply the part of "the_repository.pending.cocci" pertaining to
"pretty.h".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2023-03-28 15:58:51 +02:00
committed by Junio C Hamano
parent bc726bd075
commit bab821646a
16 changed files with 54 additions and 35 deletions

View File

@ -719,7 +719,7 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,
* duplicate the subject line.
*/
fmt = starts_with(subject, "amend!") ? "%b" : "%B";
format_commit_message(commit, fmt, sb, ctx);
repo_format_commit_message(the_repository, commit, fmt, sb, ctx);
repo_unuse_commit_buffer(the_repository, commit, buffer);
}
@ -760,8 +760,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
if (!c)
die(_("could not lookup commit %s"), squash_message);
ctx.output_encoding = get_commit_output_encoding();
format_commit_message(c, "squash! %s\n\n", &sb,
&ctx);
repo_format_commit_message(the_repository, c,
"squash! %s\n\n", &sb,
&ctx);
}
}
@ -795,7 +796,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
die(_("could not lookup commit %s"), fixup_commit);
ctx.output_encoding = get_commit_output_encoding();
fmt = xstrfmt("%s! %%s\n\n", fixup_prefix);
format_commit_message(commit, fmt, &sb, &ctx);
repo_format_commit_message(the_repository, commit, fmt, &sb,
&ctx);
free(fmt);
hook_arg1 = "message";
@ -1135,7 +1137,8 @@ static const char *find_author_by_nickname(const char *name)
struct pretty_print_context ctx = {0};
ctx.date_mode.type = DATE_NORMAL;
strbuf_release(&buf);
format_commit_message(commit, "%aN <%aE>", &buf, &ctx);
repo_format_commit_message(the_repository, commit,
"%aN <%aE>", &buf, &ctx);
release_revisions(&revs);
return strbuf_detach(&buf, NULL);
}