diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-05-04 15:51:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-05-04 15:51:27 -0700 |
commit | 5ead6a6fdb5f613cbe252e264e18db709994cfe4 (patch) | |
tree | 94b2065122b495cb5aef5dc177b3eefb164ed289 /pretty.c | |
parent | 59b2389c324dbbb335bd3375d950433b600eee90 (diff) | |
parent | 990f6e30eb00adeb8cad75c3be34c0fc9ff6abb0 (diff) | |
download | git-5ead6a6fdb5f613cbe252e264e18db709994cfe4.tar.gz |
Merge branch 'jk/format-patch-multiline-header'
* jk/format-patch-multiline-header:
format-patch: wrap email addresses after long names
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -287,6 +287,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])) @@ -294,6 +295,14 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb, display_name_length = name_tail - line; strbuf_addstr(sb, "From: "); add_rfc2047(sb, line, display_name_length, encoding); + 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 { |