Skip to contentSkip to conversation

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

PATCH In review Horst H. von Brand 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

  $ git send-email [email protected] --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 <[email protected]> from line 'From: Horst H. von Brand <[email protected]>'
  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 <[email protected]>
  To: [email protected]

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 <[email protected]> 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.

Signature · 4 lines
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
#1 lore raw

PATCH 1/1 git-send-email: default value for "From:" field.

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.

---
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(-)
git-send-email.perl +2 -3
index 4c87c20..ba39d39 100755
@@ -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++;
 }
Signature · 1 line
1.4.4.3.q5
#2 lore raw

Re: [PATCH] git-send-email: default value for "From:" field.

Quoted 9 lines · Quy Tonthat

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.

---
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);
Signature · 2 lines
Timur Tabi
Linux Kernel Developer @ Freescale
#3 lore raw

Re: [PATCH] git-send-email: default value for "From:" field.

Quoted 15 lines · Timur Tabi
Quoted 9 lines · Quy Tonthat

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.

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

Quoted 10 lines
        $_ = $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