diff options
| author | Jiang Xin <worldhello.net@gmail.com> | 2023-08-16 07:24:56 +0800 |
|---|---|---|
| committer | Jiang Xin <worldhello.net@gmail.com> | 2023-08-16 07:24:56 +0800 |
| commit | 62a26b36bd9bf76feb6940e2bee732bd62b429f8 (patch) | |
| tree | 3500be70c7d872566578e3fa324f1a8d1fe796e7 /git-send-email.perl | |
| parent | 450f2c9e3e461e4785643730f9c82eb9a64faddd (diff) | |
| parent | f1ed9d7dc0e49dc1a044941d821c9d2342313c26 (diff) | |
| download | git-62a26b36bd9bf76feb6940e2bee732bd62b429f8.tar.gz | |
Merge branch 'master' of github.com:git/git
* 'master' of github.com:git/git: (34 commits)
Git 2.42-rc2
t4053: avoid writing to unopened pipe
t4053: avoid race when killing background processes
Git 2.42-rc1
git maintenance: avoid console window in scheduled tasks on Windows
win32: add a helper to run `git.exe` without a foreground window
t9001: remove excessive GIT_SEND_EMAIL_NOTTY=1
mv: handle lstat() failure correctly
parse-options: disallow negating OPTION_SET_INT 0
repack: free geometry struct
send-email: avoid creating more than one Term::ReadLine object
send-email: drop FakeTerm hack
t0040: declare non-tab indentation to be okay in this script
advice: handle "rebase" in error_resolve_conflict()
A few more topics before -rc1
mailmap: change primary address for Glen Choo
gitignore: ignore clangd .cache directory
docs: update when `git bisect visualize` uses `gitk`
compat/mingw: implement a native locate_in_PATH()
run-command: conditionally define locate_in_PATH()
...
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 { |
