зеркало из https://github.com/microsoft/git.git
pretty.c: free get_header() return value
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
7ed863a85a
Коммит
9cd7a92b97
7
pretty.c
7
pretty.c
|
@ -1013,7 +1013,6 @@ void format_commit_message(const struct commit *commit,
|
||||||
{
|
{
|
||||||
struct format_commit_context context;
|
struct format_commit_context context;
|
||||||
static const char utf8[] = "UTF-8";
|
static const char utf8[] = "UTF-8";
|
||||||
const char *enc;
|
|
||||||
const char *output_enc = pretty_ctx->output_encoding;
|
const char *output_enc = pretty_ctx->output_encoding;
|
||||||
|
|
||||||
memset(&context, 0, sizeof(context));
|
memset(&context, 0, sizeof(context));
|
||||||
|
@ -1022,10 +1021,10 @@ void format_commit_message(const struct commit *commit,
|
||||||
context.wrap_start = sb->len;
|
context.wrap_start = sb->len;
|
||||||
context.message = commit->buffer;
|
context.message = commit->buffer;
|
||||||
if (output_enc) {
|
if (output_enc) {
|
||||||
enc = get_header(commit, "encoding");
|
char *enc = get_header(commit, "encoding");
|
||||||
enc = enc ? enc : utf8;
|
if (strcmp(enc ? enc : utf8, output_enc))
|
||||||
if (strcmp(enc, output_enc))
|
|
||||||
context.message = logmsg_reencode(commit, output_enc);
|
context.message = logmsg_reencode(commit, output_enc);
|
||||||
|
free(enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_expand(sb, format, format_commit_item, &context);
|
strbuf_expand(sb, format, format_commit_item, &context);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче