summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index 4c5dfa9af0..dc5a0643f3 100644
--- a/commit.c
+++ b/commit.c
@@ -721,7 +721,10 @@ static char *logmsg_reencode(const struct commit *commit,
encoding = get_header(commit, "encoding");
use_encoding = encoding ? encoding : utf8;
if (!strcmp(use_encoding, output_encoding))
- out = xstrdup(commit->buffer);
+ if (encoding) /* we'll strip encoding header later */
+ out = xstrdup(commit->buffer);
+ else
+ return NULL; /* nothing to do */
else
out = reencode_string(commit->buffer,
output_encoding, use_encoding);