summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/commit.c b/commit.c
index afdf27eece..2a58175aca 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);
@@ -701,7 +703,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
const char *after_subject,
int relative_date)
{
- int hdr = 1, body = 0;
+ int hdr = 1, body = 0, seen_title = 0;
unsigned long offset = 0;
int indent = 4;
int parents_shown = 0;
@@ -807,6 +809,8 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
body = 1;
if (is_empty_line(line, &linelen)) {
+ if (!seen_title)
+ continue;
if (!body)
continue;
if (subject)
@@ -815,6 +819,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
break;
}
+ seen_title = 1;
if (subject) {
int slen = strlen(subject);
memcpy(buf + offset, subject, slen);