summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2018-08-25 23:50:32 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-08-29 13:05:35 -0700
commit3aa4d81f88d2f09173e65eebe35a385b2a064c87 (patch)
tree2320c740c2b723593d1d871adda8a7b2f3cd75f3 /builtin
parentGit 2.18 (diff)
downloadtgif-3aa4d81f88d2f09173e65eebe35a385b2a064c87.tar.xz
mailinfo: support format=flowed
Add best-effort support for patches sent using format=flowed (RFC 3676). Remove leading spaces ("unstuff"), remove soft line breaks (indicated by space + newline), but leave the signature separator (dash dash space newline) alone. Warn in git am when encountering a format=flowed patch, because any trailing spaces would most probably be lost, as the sending MUA is encouraged to remove them when preparing the email. Provide a test patch formatted by Mozilla Thunderbird 60 using its default configuration. It reuses the contents of the file mailinfo.c before and after this patch. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/am.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 2fc2d1e82c..30c87c1953 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1243,6 +1243,10 @@ static int parse_mail(struct am_state *state, const char *mail)
fclose(mi.input);
fclose(mi.output);
+ if (mi.format_flowed)
+ warning(_("Patch sent with format=flowed; "
+ "space at the end of lines might be lost."));
+
/* Extract message and author information */
fp = xfopen(am_path(state, "info"), "r");
while (!strbuf_getline_lf(&sb, fp)) {