threads / patch / 34714

patchgit-send-email: kill $prompting variable

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

## tl;dr

2 messages between Aug 16, 2013 and Aug 19, 2013. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Rasmus Villemoes· Aug 16, 2013, 17:34 UTC · lore

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(-)
Show changes to git-send-email.perl +1 −3
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· Aug 19, 2013, 21:25 UTC · re: Rasmus Villemoes · lore

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

On Fri, Aug 16, 2013 at 05:34:04PM +0000, Rasmus Villemoes wrote:
Show 7 quoted lines
> 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

← back to recent threads