X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=commit.c;h=544e42629e3213a9927134273899d48c6cbe3161;hb=9d0524d42f340fc49f9e175d966afb7dce3854bb;hp=afdf27eeceb76f4f3842ba09b48d07bc218846d6;hpb=cc06c870685865decc7948cdb2d7e9b52ac8ee32;p=git.git diff --git a/commit.c b/commit.c index afdf27eec..544e42629 100644 --- a/commit.c +++ b/commit.c @@ -679,11 +679,13 @@ static char *logmsg_reencode(const struct commit *commit) else if (!*output_encoding) return NULL; encoding = get_header(commit, "encoding"); - if (!encoding || !strcmp(encoding, output_encoding)) { - free(encoding); + if (!encoding) return NULL; - } - out = reencode_string(commit->buffer, output_encoding, encoding); + if (!strcmp(encoding, output_encoding)) + out = strdup(commit->buffer); + else + out = reencode_string(commit->buffer, + output_encoding, encoding); if (out) out = replace_encoding_header(out, output_encoding);