git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-send-email: kill $prompting variable
@ 2013-08-16 17:34 Rasmus Villemoes
  2013-08-19 21:25 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2013-08-16 17:34 UTC (permalink / raw)
  To: gitster; +Cc: git, Rasmus Villemoes

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] git-send-email: kill $prompting variable
  2013-08-16 17:34 [PATCH] git-send-email: kill $prompting variable Rasmus Villemoes
@ 2013-08-19 21:25 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2013-08-19 21:25 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: gitster, git

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-19 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-16 17:34 [PATCH] git-send-email: kill $prompting variable Rasmus Villemoes
2013-08-19 21:25 ` Jeff King

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).