From: Eric Wong Date: Mon, 10 Feb 2025 21:09:30 +0000 (+0000) Subject: multi_git: remove redundant ops X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0032cc25d4cac7b604ec186e4eea65b47531718c;p=thirdparty%2Fpublic-inbox.git multi_git: remove redundant ops 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'. --- diff --git a/lib/PublicInbox/MultiGit.pm b/lib/PublicInbox/MultiGit.pm index 32bb35880..9be3a876e 100644 --- a/lib/PublicInbox/MultiGit.pm +++ b/lib/PublicInbox/MultiGit.pm @@ -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");