summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pretty.c b/pretty.c
index 13618d8264..dff5c8d183 100644
--- a/pretty.c
+++ b/pretty.c
@@ -339,6 +339,7 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,
if (fmt == CMIT_FMT_EMAIL) {
char *name_tail = strchr(line, '<');
int display_name_length;
+ int final_line;
if (!name_tail)
return;
while (line < name_tail && isspace(name_tail[-1]))
@@ -353,6 +354,14 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,
add_rfc2047(sb, quoted.buf, quoted.len, encoding);
strbuf_release(&quoted);
}
+ for (final_line = 0; final_line < sb->len; final_line++)
+ if (sb->buf[sb->len - final_line - 1] == '\n')
+ break;
+ if (namelen - display_name_length + final_line > 78) {
+ strbuf_addch(sb, '\n');
+ if (!isspace(name_tail[0]))
+ strbuf_addch(sb, ' ');
+ }
strbuf_add(sb, name_tail, namelen - display_name_length);
strbuf_addch(sb, '\n');
} else {