static char *logmsg_reencode(const struct commit *commit,
const char *output_encoding)
{
- static const char *utf8 = "utf-8";
+ static const char *utf8 = "UTF-8";
const char *use_encoding;
char *encoding;
char *out;
static void format_sanitized_subject(struct strbuf *sb, const char *msg)
{
size_t trimlen;
+ size_t start_len = sb->len;
int space = 2;
for (; *msg && *msg != '\n'; msg++) {
/* trim any trailing '.' or '-' characters */
trimlen = 0;
- while (sb->buf[sb->len - 1 - trimlen] == '.'
- || sb->buf[sb->len - 1 - trimlen] == '-')
+ while (sb->len - trimlen > start_len &&
+ (sb->buf[sb->len - 1 - trimlen] == '.'
+ || sb->buf[sb->len - 1 - trimlen] == '-'))
trimlen++;
strbuf_remove(sb, sb->len - trimlen, trimlen);
}
? git_log_output_encoding
: git_commit_encoding);
if (!encoding)
- encoding = "utf-8";
+ encoding = "UTF-8";
if (encoding_p)
*encoding_p = encoding;
return logmsg_reencode(commit, encoding);