{"thread":{"id":"34714","subject":"[PATCH] git-send-email: kill $prompting variable","startedAt":"2013-08-16T17:34:04Z","lastAt":"2013-08-19T21:25:59Z","messageCount":2,"participants":["Rasmus Villemoes","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"225350","messageId":"1376674444-29599-1-git-send-email-rv@rasmusvillemoes.dk","threadId":"34714","inReplyTo":null,"subject":"[PATCH] git-send-email: kill $prompting variable","fromName":"Rasmus Villemoes","fromEmail":"rv@rasmusvillemoes.dk","sentAt":"2013-08-16T17:34:04Z","receivedAt":"2013-08-16T17:34:04Z","isPatch":true,"sender":{"key":"rv@rasmusvillemoes.dk","avatar":"https://avatars.githubusercontent.com/u/4375908?v=4"},"body":"The variable $prompting is weird. It is only read in one place (when\ndeciding whether to prompt for a Message-ID to use in In-Reply-To),\nand it will be false unless we've taken the completely unrelated\nbranch filling in @initial_to.\n\nPrompting should be done if the info is needed, not if some unrelated\nitem had to be prompted for. So kill $prompting.\n\nSigned-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>\n---\n git-send-email.perl | 4 +---\n 1 file changed, 1 insertion(+), 3 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 2162478..f608d9b 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -755,13 +755,11 @@ if (!defined $sender) {\n # But it's a no-op to run sanitize_address on an already sanitized address.\n $sender = sanitize_address($sender);\n \n-my $prompting = 0;\n if (!@initial_to && !defined $to_cmd) {\n \tmy $to = ask(\"Who should the emails be sent to (if any)? \",\n \t\t     default => \"\",\n \t\t     valid_re => qr/\\@.*\\./, confirm_only => 1);\n \tpush @initial_to, parse_address_line($to) if defined $to; # sanitized/validated later\n-\t$prompting++;\n }\n \n sub expand_aliases {\n@@ -785,7 +783,7 @@ sub expand_one_alias {\n @bcclist = expand_aliases(@bcclist);\n @bcclist = validate_address_list(sanitize_address_list(@bcclist));\n \n-if ($thread && !defined $initial_reply_to && $prompting) {\n+if ($thread && !defined $initial_reply_to) {\n \t$initial_reply_to = ask(\n \t\t\"Message-ID to be used as In-Reply-To for the first email (if any)? \",\n \t\tdefault => \"\",\n-- \n1.8.4.rc3.1.g30eccb6\n"},{"id":"225482","messageId":"20130819212559.GB29258@sigill.intra.peff.net","threadId":"34714","inReplyTo":"1376674444-29599-1-git-send-email-rv@rasmusvillemoes.dk","subject":"Re: [PATCH] git-send-email: kill $prompting variable","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-08-19T21:25:59Z","receivedAt":"2013-08-19T21:25:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Aug 16, 2013 at 05:34:04PM +0000, Rasmus Villemoes wrote:\n\n> The variable $prompting is weird. It is only read in one place (when\n> deciding whether to prompt for a Message-ID to use in In-Reply-To),\n> and it will be false unless we've taken the completely unrelated\n> branch filling in @initial_to.\n> \n> Prompting should be done if the info is needed, not if some unrelated\n> item had to be prompted for. So kill $prompting.\n\nThe prompting flag dates back to 1f038a0 from late 2005. I _think_ the\nintent was that you could use certain command lines to specify the\nrequired information (like initial compose subject line, sender, etc),\nand then send-email would skip prompting for the optional information\n(like in-reply-to). That makes it easier to use in a \"batch\" mode in\nwhich the user does not want to be prompted (they do not have to give a\nblank \"--in-reply-to\" to prevent the prompt).\n\nOver the years, the set of items which triggered prompting (and which\ndepended on previous prompts) has grown and shrunk, and most prompts do\nnot respect the $prompting system at all. So I kind of doubt that\nanybody will care if it goes away; it does not make much sense at this\npoint.\n\nHowever, your patch will make the default be to ask about the initial\nmessage-id. Which is likely going to annoy people, as it is not\nnecessary (and people who care can specify it on the command line).\nWould we want to get rid of it entirely?\n\n-Peff\n"}]}