Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-08-14 23:26:41 +0300
committerJunio C Hamano <gitster@pobox.com>2023-08-14 23:26:41 +0300
commitfc71d024adbb000e692cbd06cb1a3195514ec771 (patch)
treeb84fd3adbf630588b8bc8aa00a349753ab111ee0
parent6df312ad31e6b40e93ea2b1b6b1dc452db7cc0a1 (diff)
parentc016726c2deb84bcc6a7418efad92ef0562a8af3 (diff)
Merge branch 'jk/send-email-with-new-readline'
Adjust to newer Term::ReadLine to prevent it from breaking the interactive prompt code in send-email. * jk/send-email-with-new-readline: send-email: avoid creating more than one Term::ReadLine object send-email: drop FakeTerm hack
-rwxr-xr-xgit-send-email.perl32
-rwxr-xr-xt/t9001-send-email.sh5
2 files changed, 14 insertions, 23 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index affbb88509..897cea6564 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -26,18 +26,6 @@ use Git::I18N;
Getopt::Long::Configure qw/ pass_through /;
-package FakeTerm;
-sub new {
- my ($class, $reason) = @_;
- return bless \$reason, shift;
-}
-sub readline {
- my $self = shift;
- die "Cannot use readline on FakeTerm: $$self";
-}
-package main;
-
-
sub usage {
print <<EOT;
git send-email' [<options>] <file|directory>
@@ -971,17 +959,19 @@ EOT3
do_edit(@files);
}
-sub term {
- my $term = eval {
+{
+ # Only instantiate one $term per program run, since some
+ # Term::ReadLine providers refuse to create a second instance.
+ my $term;
+ sub term {
require Term::ReadLine;
- $ENV{"GIT_SEND_EMAIL_NOTTY"}
- ? Term::ReadLine->new('git-send-email', \*STDIN, \*STDOUT)
- : Term::ReadLine->new('git-send-email');
- };
- if ($@) {
- $term = FakeTerm->new("$@: going non-interactive");
+ if (!defined $term) {
+ $term = $ENV{"GIT_SEND_EMAIL_NOTTY"}
+ ? Term::ReadLine->new('git-send-email', \*STDIN, \*STDOUT)
+ : Term::ReadLine->new('git-send-email');
+ }
+ return $term;
}
- return $term;
}
sub ask {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 48bf0af2ee..0662ff8120 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -337,13 +337,14 @@ test_expect_success $PREREQ 'Show all headers' '
test_expect_success $PREREQ 'Prompting works' '
clean_fake_sendmail &&
(echo "to@example.com" &&
- echo ""
+ echo "my-message-id@example.com"
) | GIT_SEND_EMAIL_NOTTY=1 git send-email \
--smtp-server="$(pwd)/fake.sendmail" \
$patches \
2>errors &&
grep "^From: A U Thor <author@example.com>\$" msgtxt1 &&
- grep "^To: to@example.com\$" msgtxt1
+ grep "^To: to@example.com\$" msgtxt1 &&
+ grep "^In-Reply-To: <my-message-id@example.com>" msgtxt1
'
test_expect_success $PREREQ,AUTOIDENT 'implicit ident is allowed' '