threads / discuss / 23971

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

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

## tl;dr

8 messages between Jun 1, 2010 and Jun 11, 2010.

replies: 7people: 4as markdown or json

Alexander Stein· Jun 1, 2010, 14:41 UTC · lore
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

Matthieu Moy· Jun 1, 2010, 15:46 UTC · re: Alexander Stein · lore

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

Alexander Stein <alexander.stein@informatik.tu-chemnitz.de> writes:
> 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.
[...]
> 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 :-(.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Alexander Stein· Jun 1, 2010, 18:08 UTC · re: Matthieu Moy · lore

[PATCH] 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

Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
---
 git-send-email.perl |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 111c981..4487472 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -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? ");
 }
-- 
1.6.4.4
Alexander Stein· Jun 10, 2010, 17:08 UTC · re: Alexander Stein · lore

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:
Show 51 quoted 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
> 
> Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
> ---
>  git-send-email.perl |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 111c981..4487472 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -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? ");
>  }
Ævar Arnfjörð Bjarmason· Jun 10, 2010, 17:18 UTC · re: Alexander Stein · lore

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

On Thu, Jun 10, 2010 at 17:08, Alexander Stein <alexander.stein@informatik.tu-chemnitz.de> wrote:

> Did get this patch overlooked?

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

Junio C Hamano· Jun 11, 2010, 19:06 UTC · re: Alexander Stein · lore

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

Alexander Stein <alexander.stein@informatik.tu-chemnitz.de> writes:
> Did get this patch overlooked?

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

Alexander Stein· Jun 11, 2010, 20:11 UTC · re: Junio C Hamano · lore

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:
> 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
Matthieu Moy· Jun 10, 2010, 22:28 UTC · re: Alexander Stein · lore

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

Alexander Stein <alexander.stein@informatik.tu-chemnitz.de> writes:
> 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.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

← back to recent threads