git-send-email: replace "map" in void context with "for"

While using "map" instead of "for" or "map" instead of "grep" and
vice-versa makes for interesting trivia questions when interviewing
Perl programmers, it doesn't make for very readable code. Let's
refactor this loop initially added in 8fd5bb7f44 (git send-email: add
--annotate option, 2008-11-11) to be a for-loop instead.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2021-04-02 13:34:33 +02:00 committed by Junio C Hamano
parent a65ce7f831
commit b362acf575

View File

@ -217,12 +217,12 @@ sub do_edit {
$editor = Git::command_oneline('var', 'GIT_EDITOR'); $editor = Git::command_oneline('var', 'GIT_EDITOR');
} }
if (defined($multiedit) && !$multiedit) { if (defined($multiedit) && !$multiedit) {
map { for (@_) {
system('sh', '-c', $editor.' "$@"', $editor, $_); system('sh', '-c', $editor.' "$@"', $editor, $_);
if (($? & 127) || ($? >> 8)) { if (($? & 127) || ($? >> 8)) {
die(__("the editor exited uncleanly, aborting everything")); die(__("the editor exited uncleanly, aborting everything"));
} }
} @_; }
} else { } else {
system('sh', '-c', $editor.' "$@"', $editor, @_); system('sh', '-c', $editor.' "$@"', $editor, @_);
if (($? & 127) || ($? >> 8)) { if (($? & 127) || ($? >> 8)) {