# [PATCH] git-send-email: kill $prompting variable

2 messages from 2013-08-16 to 2013-08-19. Participants: Rasmus Villemoes, Jeff King.
Thread: https://gitlist.dev/t/34714

## Rasmus Villemoes, 2013-08-16 17:34

Subject: [PATCH] git-send-email: kill $prompting variable
Message-ID: <1376674444-29599-1-git-send-email-rv@rasmusvillemoes.dk>
URL: https://gitlist.dev/e/1376674444-29599-1-git-send-email-rv%40rasmusvillemoes.dk

```
The variable $prompting is weird. It is only read in one place (when
deciding whether to prompt for a Message-ID to use in In-Reply-To),
and it will be false unless we've taken the completely unrelated
branch filling in @initial_to.

Prompting should be done if the info is needed, not if some unrelated
item had to be prompted for. So kill $prompting.

Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
---
 git-send-email.perl | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 2162478..f608d9b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -755,13 +755,11 @@ if (!defined $sender) {
 # But it's a no-op to run sanitize_address on an already sanitized address.
 $sender = sanitize_address($sender);
 
-my $prompting = 0;
 if (!@initial_to && !defined $to_cmd) {
 	my $to = ask("Who should the emails be sent to (if any)? ",
 		     default => "",
 		     valid_re => qr/\@.*\./, confirm_only => 1);
 	push @initial_to, parse_address_line($to) if defined $to; # sanitized/validated later
-	$prompting++;
 }
 
 sub expand_aliases {
@@ -785,7 +783,7 @@ sub expand_one_alias {
 @bcclist = expand_aliases(@bcclist);
 @bcclist = validate_address_list(sanitize_address_list(@bcclist));
 
-if ($thread && !defined $initial_reply_to && $prompting) {
+if ($thread && !defined $initial_reply_to) {
 	$initial_reply_to = ask(
 		"Message-ID to be used as In-Reply-To for the first email (if any)? ",
 		default => "",
-- 
1.8.4.rc3.1.g30eccb6

```

## Jeff King, 2013-08-19 21:25

Subject: Re: [PATCH] git-send-email: kill $prompting variable
Message-ID: <20130819212559.GB29258@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20130819212559.GB29258%40sigill.intra.peff.net
In-Reply-To: <1376674444-29599-1-git-send-email-rv@rasmusvillemoes.dk>

```
On Fri, Aug 16, 2013 at 05:34:04PM +0000, Rasmus Villemoes wrote:

> The variable $prompting is weird. It is only read in one place (when
> deciding whether to prompt for a Message-ID to use in In-Reply-To),
> and it will be false unless we've taken the completely unrelated
> branch filling in @initial_to.
> 
> Prompting should be done if the info is needed, not if some unrelated
> item had to be prompted for. So kill $prompting.

The prompting flag dates back to 1f038a0 from late 2005. I _think_ the
intent was that you could use certain command lines to specify the
required information (like initial compose subject line, sender, etc),
and then send-email would skip prompting for the optional information
(like in-reply-to). That makes it easier to use in a "batch" mode in
which the user does not want to be prompted (they do not have to give a
blank "--in-reply-to" to prevent the prompt).

Over the years, the set of items which triggered prompting (and which
depended on previous prompts) has grown and shrunk, and most prompts do
not respect the $prompting system at all. So I kind of doubt that
anybody will care if it goes away; it does not make much sense at this
point.

However, your patch will make the default be to ask about the initial
message-id. Which is likely going to annoy people, as it is not
necessary (and people who care can specify it on the command line).
Would we want to get rid of it entirely?

-Peff

```
