]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
git: speed up Git->new by 5% or so
authorEric Wong <e@80x24.org>
Tue, 28 Nov 2023 14:56:24 +0000 (14:56 +0000)
committerEric Wong <e@80x24.org>
Wed, 29 Nov 2023 02:13:24 +0000 (02:13 +0000)
This becomes noticeable when loading lots of coderepos on
my local mirror of git.kernel.org now that we can load repos
from cindex.

lib/PublicInbox/Git.pm

index a374649f1809aaa40c9035fdb74cc382c765127e..235a35cd97881efbb3a73f7b2cacfb665b28b620 100644 (file)
@@ -91,8 +91,9 @@ sub git_quote ($) {
 
 sub new {
        my ($class, $git_dir) = @_;
+       $git_dir .= '/';
        $git_dir =~ tr!/!/!s;
-       $git_dir =~ s!/*\z!!s;
+       chop $git_dir;
        # may contain {-tmp} field for File::Temp::Dir
        bless { git_dir => $git_dir }, $class
 }