Skip to contentSkip to conversation

git send-email should always ask for in-reply-to

PATCH In review Alexander Stein 4 participants 8 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

i currently have the problem that, if I set sendemail.from and sendemail.to in git-config (from global and to project-specific but that doesn't matter) git send-email doesn't ask me for a in-reply-to message-ID. I set these 2 config options for convenience. But i also want to specify a message-id after calling git send-email to get a proper thread on the mailing list.
I dived into git-send-email.perl and found $prompting which is only != 0 if $sender or @to isn't already set (lines 672-685). On line 706-709 there are some check whether $initial_reply_to should be asked or not. If $prompting is sitll 0 $initial_reply_to will not be asked.
In my opinion git send-email should always ask for in-reply-to. I know there is --in-reply-to option but this keeps me from using the git command from shell history as i have to modify the parameter each time.

What do you think about it?
Best regards
Alexander

#1 lore raw
Quoted 3 lines · Alexander Stein

i currently have the problem that, if I set sendemail.from and sendemail.to in git-config (from global and to project-specific but that doesn't matter) git send-email doesn't ask me for a in-reply-to message-ID.

[...]

Quoted 1 line

What do you think about it?

I do find this annoying: my name doesn't change often, so I want to give it in ~/.gitconfig, but then the prompt for a message-id disapears. But I didn't find time to make a patch :-(.

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#2 lore raw

PATCH 1/1 send-email: Ask for in-reply message ID even if from and to is already known

This patch removes the prompting variable so git send-email always asks for a in-reply message ID (unless specified on command line) even when sendemail.from and sendemail.to is set in ~/.gitconfig or .git/config

---
 git-send-email.perl |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
git-send-email.perl +2 -5
index 111c981..4487472 100755
@@ -136,7 +136,7 @@ my $auth;
 sub unique_email_list(@);
 sub cleanup_compose_files();
 
-# Variables we fill in automatically, or via prompting:
+# Variables we fill in automatically:
 my (@to,$no_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
 	$initial_reply_to,$initial_subject,@files,
 	$author,$sender,$smtp_authpass,$annotate,$compose,$time);
@@ -669,19 +669,16 @@ sub ask {
 	return undef;
 }
 
-my $prompting = 0;
 if (!defined $sender) {
 	$sender = $repoauthor || $repocommitter || '';
 	$sender = ask("Who should the emails appear to be from? [$sender] ",
 	              default => $sender);
 	print "Emails will be sent from: ", $sender, "\n";
-	$prompting++;
 }
 
 if (!@to) {
 	my $to = ask("Who should the emails be sent to? ");
 	push @to, parse_address_line($to) if defined $to; # sanitized/validated later
-	$prompting++;
 }
 
 sub expand_aliases {
@@ -703,7 +700,7 @@ sub expand_one_alias {
 @initial_cc = expand_aliases(@initial_cc);
 @bcclist = expand_aliases(@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? ");
 }
Signature · 1 line
1.6.4.4
#3 lore raw

Re: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known

Did get this patch overlooked?

Am Dienstag 01 Juni 2010, 20:08:50 schrieb Alexander Stein:

Quoted 51 lines

This patch removes the prompting variable so git send-email always asks for a in-reply message ID (unless specified on command line) even when sendemail.from and sendemail.to is set in ~/.gitconfig or .git/config

---
 git-send-email.perl |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
git-send-email.perl +2 -4
index 111c981..4487472 100755
@@ -136,7 +136,7 @@ my $auth;
 sub unique_email_list(@);
 sub cleanup_compose_files();
 
-# Variables we fill in automatically, or via prompting:
+# Variables we fill in automatically:
 my (@to,$no_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
 	$initial_reply_to,$initial_subject,@files,
 	$author,$sender,$smtp_authpass,$annotate,$compose,$time);
@@ -669,19 +669,16 @@ sub ask {
 	return undef;
 }
 
-my $prompting = 0;
 if (!defined $sender) {
 	$sender = $repoauthor || $repocommitter || '';
 	$sender = ask("Who should the emails appear to be from? [$sender] ",
 	              default => $sender);
 	print "Emails will be sent from: ", $sender, "\n";
-	$prompting++;
 }
 
 if (!@to) {
 	my $to = ask("Who should the emails be sent to? ");
 	push @to, parse_address_line($to) if defined $to; # sanitized/validated
 later -	$prompting++;
 }
 
 sub expand_aliases {
@@ -703,7 +700,7 @@ sub expand_one_alias {
 @initial_cc = expand_aliases(@initial_cc);
 @bcclist = expand_aliases(@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? ");
 }
#4 lore raw

Re: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known

Quoted 1 line · Alexander Stein

Did get this patch overlooked?

Did you run the existing test suite unattended and make sure everything still passes?

#5 lore raw

Re: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known

Am Freitag 11 Juni 2010, 21:06:53 schrieb Junio C Hamano:

Quoted 2 lines

Did you run the existing test suite unattended and make sure everything still passes?

During test suite run I noticed this patch doesn't allow to run the suite unattended. This may only work with some config option as Matthieu already pointed out.
I will rethink about this problem and repost a new patch

Alexander

#6 lore raw

Re: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known

In reply to Alexander Stein
Quoted 1 line · Alexander Stein

Did get this patch overlooked?

Perhaps it would be better accompanied with a test addition in t9001-send-email.sh.

#7 lore raw

Re: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known

In reply to Alexander Stein
Quoted 3 lines · Alexander Stein

This patch removes the prompting variable so git send-email always asks for a in-reply message ID (unless specified on command line) even when sendemail.from and sendemail.to is set in ~/.gitconfig or .git/config

Does this mean there's no way to run send-email non-interactively without a reply-to?

I do want to get the prompt even though I want to set the sender field in my ~/.gitconfig, but I wouldn't want the prompt to appear in the cron job I run every nights to send me new patches in some repo for example (a change in git-send-email already broke it in the past, that's a rather anoying failure).

You probably want an option to enable/disable prompting. I'm not sure whether it should be opt-in or opt-out.

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/