File tree Expand file tree Collapse file tree 2 files changed +14
-23
lines changed Expand file tree Collapse file tree 2 files changed +14
-23
lines changed Original file line number Diff line number Diff line change 2626
2727Getopt::Long::Configure qw/ pass_through / ;
2828
29- package FakeTerm ;
30- sub new {
31- my ($class , $reason ) = @_ ;
32- return bless \$reason , shift ;
33- }
34- sub readline {
35- my $self = shift ;
36- die " Cannot use readline on FakeTerm: $$self " ;
37- }
38- package main ;
39-
40-
4129sub usage {
4230 print <<EOT ;
4331git send-email' [<options>] <file|directory>
@@ -971,17 +959,19 @@ sub get_patch_subject {
971959 do_edit(@files);
972960}
973961
974- sub term {
975- my $term = eval {
962+ {
963+ # Only instantiate one $term per program run, since some
964+ # Term::ReadLine providers refuse to create a second instance.
965+ my $term;
966+ sub term {
976967 require Term::ReadLine;
977- $ENV{"GIT_SEND_EMAIL_NOTTY"}
978- ? Term::ReadLine->new( ' git- send -email ' , \*STDIN, \*STDOUT)
979- : Term::ReadLine->new(' git-send -email' );
980- } ;
981- if ($@) {
982- $term = FakeTerm->new("$@: going non-interactive") ;
968+ if (!defined $term) {
969+ $term = $ENV{"GIT_SEND_EMAIL_NOTTY"}
970+ ? Term::ReadLine->new(' git-send -email' , \*STDIN, \*STDOUT)
971+ : Term::ReadLine->new( ' git- send -email ' ) ;
972+ }
973+ return $term ;
983974 }
984- return $term;
985975}
986976
987977sub ask {
Original file line number Diff line number Diff line change @@ -337,13 +337,14 @@ test_expect_success $PREREQ 'Show all headers' '
337337test_expect_success $PREREQ ' Prompting works' '
338338 clean_fake_sendmail &&
339339 (echo "to@example.com" &&
340- echo ""
340+ echo "my-message-id@example.com "
341341 ) | GIT_SEND_EMAIL_NOTTY=1 git send-email \
342342 --smtp-server="$(pwd)/fake.sendmail" \
343343 $patches \
344344 2>errors &&
345345 grep "^From: A U Thor <author@example.com>\$" msgtxt1 &&
346- grep "^To: to@example.com\$" msgtxt1
346+ grep "^To: to@example.com\$" msgtxt1 &&
347+ grep "^In-Reply-To: <my-message-id@example.com>" msgtxt1
347348'
348349
349350test_expect_success $PREREQ ,AUTOIDENT ' implicit ident is allowed' '
You can’t perform that action at this time.
0 commit comments