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

8 messages from 2010-06-01 to 2010-06-11. Participants: Alexander Stein, Matthieu Moy, Ævar Arnfjörð Bjarmason, Junio C Hamano.
Thread: https://gitlist.dev/t/23971

## Alexander Stein, 2010-06-01 14:41

Subject: git send-email should always ask for in-reply-to
Message-ID: <201006011641.12401.alexander.stein@informatik.tu-chemnitz.de>
URL: https://gitlist.dev/e/201006011641.12401.alexander.stein%40informatik.tu-chemnitz.de

```
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, 2010-06-01 15:46

Subject: Re: git send-email should always ask for in-reply-to
Message-ID: <vpqtypmn4bm.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqtypmn4bm.fsf%40bauges.imag.fr
In-Reply-To: <201006011641.12401.alexander.stein@informatik.tu-chemnitz.de>

```
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, 2010-06-01 18:08

Subject: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known
Message-ID: <1275415730-15360-1-git-send-email-alexander.stein@informatik.tu-chemnitz.de>
URL: https://gitlist.dev/e/1275415730-15360-1-git-send-email-alexander.stein%40informatik.tu-chemnitz.de
In-Reply-To: <vpqtypmn4bm.fsf@bauges.imag.fr>

```
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, 2010-06-10 17:08

Subject: Re: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known
Message-ID: <201006101908.19578.alexander.stein@informatik.tu-chemnitz.de>
URL: https://gitlist.dev/e/201006101908.19578.alexander.stein%40informatik.tu-chemnitz.de
In-Reply-To: <1275415730-15360-1-git-send-email-alexander.stein@informatik.tu-chemnitz.de>

```
Did get this patch overlooked?

Am Dienstag 01 Juni 2010, 20:08:50 schrieb 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
> 
> 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, 2010-06-10 17:18

Subject: Re: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known
Message-ID: <AANLkTikHhYcNRPOIWuMYjCnWahS2ydQZ2-vpswSYYohx@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikHhYcNRPOIWuMYjCnWahS2ydQZ2-vpswSYYohx%40mail.gmail.com
In-Reply-To: <201006101908.19578.alexander.stein@informatik.tu-chemnitz.de>

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

```

## Matthieu Moy, 2010-06-10 22:28

Subject: Re: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known
Message-ID: <vpqpqzyzfmd.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqpqzyzfmd.fsf%40bauges.imag.fr
In-Reply-To: <1275415730-15360-1-git-send-email-alexander.stein@informatik.tu-chemnitz.de>

```
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/

```

## Junio C Hamano, 2010-06-11 19:06

Subject: Re: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known
Message-ID: <7vtyp9ie2a.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vtyp9ie2a.fsf%40alter.siamese.dyndns.org
In-Reply-To: <201006101908.19578.alexander.stein@informatik.tu-chemnitz.de>

```
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, 2010-06-11 20:11

Subject: Re: [PATCH] send-email: Ask for in-reply message ID even if from and to is already known
Message-ID: <201006112211.59425.alexander.stein@informatik.tu-chemnitz.de>
URL: https://gitlist.dev/e/201006112211.59425.alexander.stein%40informatik.tu-chemnitz.de
In-Reply-To: <7vtyp9ie2a.fsf@alter.siamese.dyndns.org>

```
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

```
