diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-05-30 16:58:12 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-05-30 16:58:12 -0700 |
| commit | f20b96a7982915b080f556430a2a5d4ce805adb7 (patch) | |
| tree | 9da0e1a36964e4ee5ccdfd93a16d19ade7d32d85 /git-send-email.perl | |
| parent | Git 2.41.1 (diff) | |
| parent | Merge branch 'fixes/2.45.1/2.40' into fixes/2.45.1/2.41 (diff) | |
| download | git-f20b96a7982915b080f556430a2a5d4ce805adb7.tar.gz git-f20b96a7982915b080f556430a2a5d4ce805adb7.zip | |
Merge branch 'fixes/2.45.1/2.41' into maint-2.41
* fixes/2.45.1/2.41:
Revert "fsck: warn about symlink pointing inside a gitdir"
Revert "Add a helper function to compare file contents"
clone: drop the protections where hooks aren't run
tests: verify that `clone -c core.hooksPath=/dev/null` works again
Revert "core.hooksPath: add some protection while cloning"
init: use the correct path of the templates directory again
hook: plug a new memory leak
ci: stop installing "gcc-13" for osx-gcc
ci: avoid bare "gcc" for osx-gcc job
ci: drop mention of BREW_INSTALL_PACKAGES variable
send-email: avoid creating more than one Term::ReadLine object
send-email: drop FakeTerm hack
Diffstat (limited to 'git-send-email.perl')
| -rwxr-xr-x | git-send-email.perl | 32 |
1 files changed, 11 insertions, 21 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 { |
