]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-send-email: replace "map" in void context with "for"
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 2 Apr 2021 11:34:33 +0000 (13:34 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Apr 2021 21:32:29 +0000 (14:32 -0700)
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 8fd5bb7f44b (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>
git-send-email.perl

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