From: "Đoàn Trần Công Danh" <congdanhqx@gmail.com> To: Junio C Hamano <gitster@pobox.com> Cc: git@vger.kernel.org, "brian m. carlson" <sandals@crustytoothpaste.net> Subject: Re: [PATCH v2 3/5] mailinfo: skip quoted CR on user's wish Date: Wed, 5 May 2021 22:53:45 +0700 [thread overview] Message-ID: <YJK/ieA7fzB+h01t@danh.dev> (raw) In-Reply-To: <xmqqeeel4y5f.fsf@gitster.g> On 2021-05-05 13:12:12+0900, Junio C Hamano <gitster@pobox.com> wrote: > > diff --git a/Documentation/git-mailinfo.txt b/Documentation/git-mailinfo.txt > > index d343f040f5..c776b27515 100644 > > --- a/Documentation/git-mailinfo.txt > > +++ b/Documentation/git-mailinfo.txt > > @@ -9,7 +9,7 @@ git-mailinfo - Extracts patch and authorship from a single e-mail message > > SYNOPSIS > > -------- > > [verse] > > -'git mailinfo' [-k|-b] [-u | --encoding=<encoding> | -n] [--[no-]scissors] <msg> <patch> > > +'git mailinfo' [-k|-b] [-u | --encoding=<encoding> | -n] [--[no-]scissors] [--quoted-cr=<action>] <msg> <patch> > > This line is getting really crowded. Perhaps it is time to do > > 'git mailinfo' [<options>] <msg> <patch> > > like other Git subcommands with too many options? Certainly it can > be done after the dust settles from this entire series as a follow up > clean-up patch. Yes, I think it's time to do that clean-up. > > static const char mailinfo_usage[] = > > - "git mailinfo [-k | -b] [-m | --message-id] [-u | --encoding=<encoding> | -n] [--scissors | --no-scissors] <msg> <patch> < mail >info"; > > + "git mailinfo [-k | -b] [-m | --message-id] [-u | --encoding=<encoding> | -n] [--scissors | --no-scissors] [--quoted-cr=<action>] <msg> <patch> < mail >info"; > > It is surprising that we haven't switched this to parse_options(). > It of course is outside the scope of this series, but from a cursory > look of its option parsing loop, it looks like a trivial improvement > to make. And given that we also need 1/5 (otherwise, we need a new declaration for "const char *str"), I think it would be better to turn 1/5 to the conversion to parse_option. > > @@ -43,7 +43,11 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix) > > mi.use_scissors = 0; > > else if (!strcmp(argv[1], "--no-inbody-headers")) > > mi.use_inbody_headers = 0; > > - else > > + else if (skip_prefix(argv[1], "--quoted-cr=", &str)) { > > + mi.quoted_cr = mailinfo_parse_quoted_cr_action(str); > > + if (mi.quoted_cr == quoted_cr_invalid_action) > > + usage(mailinfo_usage); > > This is not all that helpful, given that mailinfo_usage[] only says > <action> without saying what the supported values are, and the > message does not make it clear it was issued while looking at the > --quoted-cr option. > > At least, something like > > if (mi.quoted_cr == quoted_cr_invalid_action) > die("--quoted-cr=%s: invalid action", str); > > would be more palatable, but I wonder if mailinfo_parse_quoted_cr_action() > should have an option to die with the list of actions it knows about > in a message. I tempted to remove the _invalid_action with the re-roll and always die when it doesn't understand the actions instead. Let's see how far I can get with that approach. -- Danh
next prev parent reply other threads:[~2021-05-05 15:53 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-21 1:34 [PATCH] mailinfo: strip CR from base64/quoted-printable email Đoàn Trần Công Danh 2021-04-21 2:09 ` Junio C Hamano 2021-04-21 3:32 ` brian m. carlson 2021-04-21 12:07 ` Đoàn Trần Công Danh 2021-04-22 1:10 ` brian m. carlson 2021-05-04 17:19 ` [PATCH v2 0/5] Teach am/mailinfo to process quoted CR Đoàn Trần Công Danh 2021-05-04 17:19 ` [PATCH v2 1/5] mailinfo: avoid magic number in option parsing Đoàn Trần Công Danh 2021-05-04 17:19 ` [PATCH v2 2/5] mailinfo: warn if CR found in base64/quoted-printable email Đoàn Trần Công Danh 2021-05-05 3:41 ` Junio C Hamano 2021-05-04 17:20 ` [PATCH v2 3/5] mailinfo: skip quoted CR on user's wish Đoàn Trần Công Danh 2021-05-05 4:12 ` Junio C Hamano 2021-05-05 15:53 ` Đoàn Trần Công Danh [this message] 2021-05-04 17:20 ` [PATCH v2 4/5] mailinfo: strip quoted CR on users' wish Đoàn Trần Công Danh 2021-05-05 4:27 ` Junio C Hamano 2021-05-04 17:20 ` [PATCH v2 5/5] am: learn to process quoted lines that ends with CRLF Đoàn Trần Công Danh 2021-05-05 4:31 ` [PATCH v2 0/5] Teach am/mailinfo to process quoted CR Junio C Hamano 2021-05-06 15:02 ` [PATCH v3 0/6] " Đoàn Trần Công Danh 2021-05-06 15:02 ` [PATCH v3 1/6] mailinfo: load default metainfo_charset lazily Đoàn Trần Công Danh 2021-05-06 15:02 ` [PATCH v3 2/6] mailinfo: stop parsing options manually Đoàn Trần Công Danh 2021-05-08 10:44 ` Junio C Hamano 2021-05-06 15:02 ` [PATCH v3 3/6] mailinfo: warn if CR found in decoded base64/QP email Đoàn Trần Công Danh 2021-05-08 10:52 ` Junio C Hamano 2021-05-06 15:02 ` [PATCH v3 4/6] mailinfo: allow squelching quoted CR warning Đoàn Trần Công Danh 2021-05-06 15:02 ` [PATCH v3 5/6] mailinfo: allow stripping quoted CR without warning Đoàn Trần Công Danh 2021-05-06 15:02 ` [PATCH v3 6/6] am: learn to process quoted lines that ends with CRLF Đoàn Trần Công Danh 2021-05-08 10:57 ` [PATCH v3 0/6] Teach am/mailinfo to process quoted CR Junio C Hamano [not found] ` <cover.1620309355.git.congdanhqx@gmail.com> 2021-05-06 15:02 ` [PATCH v3 2/6] mailinfo: stop parse options manually Đoàn Trần Công Danh 2021-05-06 15:19 ` Đoàn Trần Công Danh 2021-05-09 17:12 ` [PATCH v4 0/6] Teach am/mailinfo to process quoted CR Đoàn Trần Công Danh 2021-05-09 17:12 ` [PATCH v4 1/6] mailinfo: load default metainfo_charset lazily Đoàn Trần Công Danh 2021-05-09 17:12 ` [PATCH v4 2/6] mailinfo: stop parsing options manually Đoàn Trần Công Danh 2021-05-09 17:12 ` [PATCH v4 3/6] mailinfo: warn if CRLF found in decoded base64/QP email Đoàn Trần Công Danh 2021-05-09 17:12 ` [PATCH v4 4/6] mailinfo: allow squelching quoted CRLF warning Đoàn Trần Công Danh 2021-05-09 17:12 ` [PATCH v4 5/6] mailinfo: allow stripping quoted CR without warning Đoàn Trần Công Danh 2021-05-09 17:12 ` [PATCH v4 6/6] am: learn to process quoted lines that ends with CRLF Đoàn Trần Công Danh
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=YJK/ieA7fzB+h01t@danh.dev \ --to=congdanhqx@gmail.com \ --cc=git@vger.kernel.org \ --cc=gitster@pobox.com \ --cc=sandals@crustytoothpaste.net \ --subject='Re: [PATCH v2 3/5] mailinfo: skip quoted CR on user'\''s wish' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).