Skip to content

Commit

Permalink
i18n: do not leak 'encoding' header even when we cheat the conversion.
Browse files Browse the repository at this point in the history
We special case the case where encoding recorded in the commit
and the output encoding are the same and do not call iconv().
But we should drop 'encoding' header for this case as well for
consistency.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Jan 1, 2007
1 parent fbc9012 commit e90068a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit e90068a

Please sign in to comment.