summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-05-24 23:14:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-05-25 00:52:42 (GMT)
commit5b719b7552b9eca486a3a6507e9397572d16481d (patch)
tree6b5cc474e9c5ee714ae212caf6a7fe91548cba29 /git-send-email.perl
parentea7811b37e0e6fabb2a410475f198eab33110dcf (diff)
downloadgit-5b719b7552b9eca486a3a6507e9397572d16481d.zip
git-5b719b7552b9eca486a3a6507e9397572d16481d.tar.gz
git-5b719b7552b9eca486a3a6507e9397572d16481d.tar.bz2
send-email: fix missing error message regression
Fix a regression with the "the editor exited uncleanly, aborting everything" error message going missing after my d21616c0394 (git-send-email: refactor duplicate $? checks into a function, 2021-04-06). I introduced a $msg variable, but did not actually use it. This caused us to miss the optional error message supplied by the "do_edit" codepath. Fix that, and add tests to check that this works. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl12
1 files changed, 11 insertions, 1 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 175da07..170f42f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -219,8 +219,18 @@ sub system_or_msg {
my $exit_code = $? >> 8;
return unless $signalled or $exit_code;
+ my @sprintf_args = ($args->[0], $exit_code);
+ if (defined $msg) {
+ # Quiet the 'redundant' warning category, except we
+ # need to support down to Perl 5.8, so we can't do a
+ # "no warnings 'redundant'", since that category was
+ # introduced in perl 5.22, and asking for it will die
+ # on older perls.
+ no warnings;
+ return sprintf($msg, @sprintf_args);
+ }
return sprintf(__("fatal: command '%s' died with exit code %d"),
- $args->[0], $exit_code);
+ @sprintf_args);
}
sub system_or_die {