Code

Tighten refspec processing
[git.git] / git-send-email.perl
index 8e6f3b22c83d25a46069c48c13a0eebbd2196ec2..e5d67f1b6c3237ff67673037be5ca8997cdb191d 100755 (executable)
@@ -166,7 +166,9 @@ my $envelope_sender;
 
 my $repo = Git->repository();
 my $term = eval {
-       new Term::ReadLine 'git-send-email';
+       $ENV{"GIT_SEND_EMAIL_NOTTY"}
+               ? new Term::ReadLine 'git-send-email', \*STDIN, \*STDOUT
+               : new Term::ReadLine 'git-send-email';
 };
 if ($@) {
        $term = new FakeTerm "$@: going non-interactive";
@@ -407,8 +409,9 @@ if ($thread && !defined $initial_reply_to && $prompting) {
        $initial_reply_to = $_;
 }
 if (defined $initial_reply_to) {
-       $initial_reply_to =~ s/^\s*<?/</;
-       $initial_reply_to =~ s/>?\s*$/>/;
+       $initial_reply_to =~ s/^\s*<?//;
+       $initial_reply_to =~ s/>?\s*$//;
+       $initial_reply_to = "<$initial_reply_to>" if $initial_reply_to ne '';
 }
 
 if (!defined $smtp_server) {