]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
multi_git: remove redundant ops
authorEric Wong <e@80x24.org>
Mon, 10 Feb 2025 21:09:30 +0000 (21:09 +0000)
committerEric Wong <e@80x24.org>
Tue, 11 Feb 2025 19:08:10 +0000 (19:08 +0000)
read_all already returns an array in array context so the
`split' op is unnecessary, and we don't need to use
`join("", ...)' on arrays that are destined for `print'
or `say'.

lib/PublicInbox/MultiGit.pm

index 32bb3588041d6316a208cdc0c636b1729004176e..9be3a876e49d99cfeca747a7cc6eeb6dbdefd400 100644 (file)
@@ -34,7 +34,7 @@ sub read_alternates {
                        qr!\A\Q../../$self->{epfx}\E/([0-9]+)\.git/objects\z! :
                        undef;
                $$moderef = (stat($fh))[2] & 07777;
-               for my $rel (split(/^/m, read_all($fh, -s _))) {
+               for my $rel (read_all($fh, -s _)) {
                        chomp(my $dir = $rel);
                        my $score;
                        if (defined($is_edir) && $dir =~ $is_edir) {
@@ -67,10 +67,10 @@ sub write_alternates {
        my ($self, $mode, $alt, @new) = @_;
        my $all_dir = "$self->{topdir}/$self->{all}";
        PublicInbox::Import::init_bare($all_dir);
-       my $out = join('', sort { $alt->{$b} <=> $alt->{$a} } keys %$alt);
+       my @out = sort { $alt->{$b} <=> $alt->{$a} } keys %$alt;
        my $info_dir = "$all_dir/objects/info";
        my $fh = File::Temp->new(TEMPLATE => 'alt-XXXX', DIR => $info_dir);
-       print $fh $out, @new;
+       print $fh @out, @new;
        chmod($mode, $fh);
        close $fh;
        rename($fh->filename, "$info_dir/alternates");