summaryrefslogtreecommitdiff
path: root/builtin/mailinfo.c
diff options
context:
space:
mode:
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>2021-05-10 00:12:11 +0700
committerJunio C Hamano <gitster@pobox.com>2021-05-10 15:06:22 +0900
commitf1aa29944320e51441e5b5e32591e69f2fa74de2 (patch)
treee91b0c0cc616a2f3d3c82f8595d2c2bf05b2f536 /builtin/mailinfo.c
parent0b689562cafc05b1a36bdea3d025c9ecdf2514bd (diff)
downloadgit-f1aa29944320e51441e5b5e32591e69f2fa74de2.tar.gz
mailinfo: allow squelching quoted CRLF warning
In previous change, Git starts to warn for quoted CRLF in decoded base64/QP email. Despite those warnings are usually helpful, quoted CRLF could be part of some users' workflow. Let's give them an option to turn off the warning completely. 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 'builtin/mailinfo.c')
-rw-r--r--builtin/mailinfo.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index f55549a097..01d16ef9e5 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -38,6 +38,15 @@ static int parse_opt_explicit_encoding(const struct option *opt,
return 0;
}
+static int parse_opt_quoted_cr(const struct option *opt, const char *arg, int unset)
+{
+ BUG_ON_OPT_NEG(unset);
+
+ if (mailinfo_parse_quoted_cr_action(arg, opt->value) != 0)
+ return error(_("bad action '%s' for '%s'"), arg, "--quoted-cr");
+ return 0;
+}
+
int cmd_mailinfo(int argc, const char **argv, const char *prefix)
{
struct metainfo_charset meta_charset;
@@ -61,6 +70,9 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix)
N_("re-code metadata to this encoding"),
PARSE_OPT_NONEG, parse_opt_explicit_encoding),
OPT_BOOL(0, "scissors", &mi.use_scissors, N_("use scissors")),
+ OPT_CALLBACK_F(0, "quoted-cr", &mi.quoted_cr, N_("<action>"),
+ N_("action when quoted CR is found"),
+ PARSE_OPT_NONEG, parse_opt_quoted_cr),
OPT_HIDDEN_BOOL(0, "inbody-headers", &mi.use_inbody_headers,
N_("use headers in message's body")),
OPT_END()