# git-1.4.4.3, also 1.5.0rc0: send-email gets empty From:

4 messages from 2006-12-27 to 2007-01-19. Participants: Horst H. von Brand, Quy Tonthat, Timur Tabi.
Thread: https://gitlist.dev/t/6126

## Horst H. von Brand, 2006-12-27 13:43

Subject: git-1.4.4.3, also 1.5.0rc0: send-email gets empty From:
Message-ID: <200612271343.kBRDhKfA009927@laptop13.inf.utfsm.cl>
URL: https://gitlist.dev/e/200612271343.kBRDhKfA009927%40laptop13.inf.utfsm.cl

```
I updated a local project, git-format-patch:ed, and then:

  $ git send-email --to=olpc@listas.inf.utfsm.cl --no-signed-off-by-cc /tmp/0001-Add-myself-to-AUTHORS.txt
  Who should the emails appear to be from? 
  Emails will be sent from: 
  Message-ID to be used as In-Reply-To for the first email? 
  /tmp/0001-Add-myself-to-AUTHORS.txt
  Use of uninitialized value in concatenation (.) or string at /usr/bin/git-send-email line 392.
  (mbox) Adding cc: Horst H. von Brand <vonbrand@inf.utfsm.cl> from line 'From: Horst H. von Brand <vonbrand@inf.utfsm.cl>'
  OK. Log says:
  Date: Wed, 27 Dec 2006 10:27:39 -0300
  Sendmail: /usr/sbin/sendmail
  From: 
  Subject: [PATCH] Add myself to AUTHORS
  Cc: Horst H. von Brand <vonbrand@inf.utfsm.cl>
  To: olpc@listas.inf.utfsm.cl

  Result: OK

I didn't add a From:, per manpage it is assumed to be GIT_COMMITER_IDENT
(from 'git-var -l' this is 'Horst H. von Brand <vonbrand@inf.utfsm.cl> 1167226309 -0300').
Note particularly the "Emails will be sent from:" line!

The resulting message is formed right (it has a From: header), so this is
just a UI glitch.

The same output from 1.5.0rc0 here.
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile               Fax:  +56 32 2797513

```

## Quy Tonthat, 2006-12-27 14:16

Subject: [PATCH] git-send-email: default value for "From:" field.
Message-ID: <45928035.6000605@gmail.com>
URL: https://gitlist.dev/e/45928035.6000605%40gmail.com
In-Reply-To: <200612271343.kBRDhKfA009927@laptop13.inf.utfsm.cl>

```
If user hits enter at the prompt for
"Who should the emails appear to be from?",
the value for "From:" field was emptied instead of GIT_COMMITER_IDENT.

Signed-off-by: Quy Tonthat <qtonthat@gmail.com>
---
It seems the original code assumes readline to accept
an extra argument for default value. I don't remember I ever encountered
that feature from readline. Is there anything like that out there ?

 git-send-email.perl |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 4c87c20..ba39d39 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -178,11 +178,10 @@ my $prompting = 0;
 if (!defined $from) {
 	$from = $author || $committer;
 	do {
-		$_ = $term->readline("Who should the emails appear to be from? ",
-			$from);
+		$_ = $term->readline("Who should the emails appear to be from? [$from] ");
 	} while (!defined $_);
 
-	$from = $_;
+	$from = $_ if ($_);
 	print "Emails will be sent from: ", $from, "\n";
 	$prompting++;
 }
-- 
1.4.4.3.q5

```

## Timur Tabi, 2007-01-18 20:39

Subject: Re: [PATCH] git-send-email: default value for "From:" field.
Message-ID: <45AFDAEA.607@freescale.com>
URL: https://gitlist.dev/e/45AFDAEA.607%40freescale.com
In-Reply-To: <45928035.6000605@gmail.com>

```
Quy Tonthat wrote:
> If user hits enter at the prompt for
> "Who should the emails appear to be from?",
> the value for "From:" field was emptied instead of GIT_COMMITER_IDENT.
> 
> Signed-off-by: Quy Tonthat <qtonthat@gmail.com>
> ---
> It seems the original code assumes readline to accept
> an extra argument for default value. I don't remember I ever encountered
> that feature from readline. Is there anything like that out there ?

I was thinking the same thing.  Almost every call to readline() in 
git-send-email is like that, so could your patch below could be expanded to 
include the other instances?

         $_ = $term->readline("Who should the emails be sent to? ",
                         "");

         $_ = $term->readline("What subject should the emails start with? ",
                 $initial_subject);

         $_= $term->readline("Message-ID to be used as In-Reply-To for the first 
email? ",
                 $initial_reply_to);

-- 
Timur Tabi
Linux Kernel Developer @ Freescale

```

## Quy Tonthat, 2007-01-19 01:14

Subject: Re: [PATCH] git-send-email: default value for "From:" field.
Message-ID: <45B01B82.9050707@gmail.com>
URL: https://gitlist.dev/e/45B01B82.9050707%40gmail.com
In-Reply-To: <45AFDAEA.607@freescale.com>

```
Timur Tabi wrote:
> Quy Tonthat wrote:
>> If user hits enter at the prompt for
>> "Who should the emails appear to be from?",
>> the value for "From:" field was emptied instead of GIT_COMMITER_IDENT.
>>
>> Signed-off-by: Quy Tonthat <qtonthat@gmail.com>
>> ---
>> It seems the original code assumes readline to accept
>> an extra argument for default value. I don't remember I ever encountered
>> that feature from readline. Is there anything like that out there ?
> 
> I was thinking the same thing.  Almost every call to readline() in
> git-send-email is like that, so could your patch below could be expanded
> to include the other instances?
> 
>         $_ = $term->readline("Who should the emails be sent to? ",
>                         "");
> 
>         $_ = $term->readline("What subject should the emails start with? ",
>                 $initial_subject);
> 
>         $_= $term->readline("Message-ID to be used as In-Reply-To for
> the first email? ",
>                 $initial_reply_to);
> 
It is correct to expand the fix to other instances, but that won't practically
change anything at run time (All those "defaults" are empty when passed to readline).
I don't normally change somebody else's codes just for the sake of correctness or styles.
Quy

```
