pretty: prepare format_commit_message to handle arbitrary repositories
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
424510ed19
commit
f54fbf5eef
15
pretty.c
15
pretty.c
@ -1508,9 +1508,10 @@ void userformat_find_requirements(const char *fmt, struct userformat_want *w)
|
||||
strbuf_release(&dummy);
|
||||
}
|
||||
|
||||
void format_commit_message(const struct commit *commit,
|
||||
const char *format, struct strbuf *sb,
|
||||
const struct pretty_print_context *pretty_ctx)
|
||||
void repo_format_commit_message(struct repository *r,
|
||||
const struct commit *commit,
|
||||
const char *format, struct strbuf *sb,
|
||||
const struct pretty_print_context *pretty_ctx)
|
||||
{
|
||||
struct format_commit_context context;
|
||||
const char *output_enc = pretty_ctx->output_encoding;
|
||||
@ -1524,9 +1525,9 @@ void format_commit_message(const struct commit *commit,
|
||||
* convert a commit message to UTF-8 first
|
||||
* as far as 'format_commit_item' assumes it in UTF-8
|
||||
*/
|
||||
context.message = logmsg_reencode(commit,
|
||||
&context.commit_encoding,
|
||||
utf8);
|
||||
context.message = repo_logmsg_reencode(r, commit,
|
||||
&context.commit_encoding,
|
||||
utf8);
|
||||
|
||||
strbuf_expand(sb, format, format_commit_item, &context);
|
||||
rewrap_message_tail(sb, &context, 0, 0, 0);
|
||||
@ -1550,7 +1551,7 @@ void format_commit_message(const struct commit *commit,
|
||||
}
|
||||
|
||||
free(context.commit_encoding);
|
||||
unuse_commit_buffer(commit, context.message);
|
||||
repo_unuse_commit_buffer(r, commit, context.message);
|
||||
}
|
||||
|
||||
static void pp_header(struct pretty_print_context *pp,
|
||||
|
||||
Reference in New Issue
Block a user