Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>2021-05-09 20:12:12 +0300
committerJunio C Hamano <gitster@pobox.com>2021-05-10 09:06:22 +0300
commit133a4fda59e7e68be13191082e14be32143bd61b (patch)
tree510662f4c6f5a4aec511b2eaf96cbb0438821055 /mailinfo.c
parentf1aa29944320e51441e5b5e32591e69f2fa74de2 (diff)
mailinfo: allow stripping quoted CR without warning
In previous changes, we've turned on warning for quoted CR in base64 or quoted-printable email messages. Some projects see those quoted CR a lot, they know that it happens most of the time, and they find it's desirable to always strip those CR. Those projects in question usually fall back to use other tools to handle patches when receive such patches. Let's help those projects handle those patches by stripping those excessive CR. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mailinfo.c')
-rw-r--r--mailinfo.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mailinfo.c b/mailinfo.c
index a784552c7b..ed863c3a95 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -998,6 +998,11 @@ static void handle_filter_flowed(struct mailinfo *mi, struct strbuf *line,
line->buf[len - 2] == '\r' &&
line->buf[len - 1] == '\n') {
mi->have_quoted_cr = 1;
+ if (mi->quoted_cr == quoted_cr_strip) {
+ strbuf_setlen(line, len - 2);
+ strbuf_addch(line, '\n');
+ len--;
+ }
}
handle_filter(mi, line);
return;
@@ -1227,6 +1232,8 @@ int mailinfo_parse_quoted_cr_action(const char *actionstr, int *action)
*action = quoted_cr_nowarn;
else if (!strcmp(actionstr, "warn"))
*action = quoted_cr_warn;
+ else if (!strcmp(actionstr, "strip"))
+ *action = quoted_cr_strip;
else
return -1;
return 0;