about summary refs log tree commit homepage
path: root/lib/PublicInbox/Git.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-09-26 10:17:15 +0000
committerEric Wong <e@80x24.org>2022-09-26 19:22:04 +0000
commit9b8ebfddd479bfeda479d2842587269dc9a21752 (patch)
treee926ac17f5bd5e62c07336b25bff1a01207d9ba9 /lib/PublicInbox/Git.pm
parent4be57c1329b13dbeb8097dd49b5e43fbc9ec9754 (diff)
downloadpublic-inbox-9b8ebfddd479bfeda479d2842587269dc9a21752.tar.gz
The {-git_path} cache can rely on auto-vivification, and
{alt_st} may not be needed for short-lived repos.  So don't
populate those fields until they're needed, since we can
expect to handle thousands of git repos, too.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r--lib/PublicInbox/Git.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index b2ae75c8..9140caea 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -66,7 +66,7 @@ sub new {
         $git_dir =~ tr!/!/!s;
         $git_dir =~ s!/*\z!!s;
         # may contain {-tmp} field for File::Temp::Dir
-        bless { git_dir => $git_dir, alt_st => '', -git_path => {} }, $class
+        bless { git_dir => $git_dir }, $class
 }
 
 sub git_path ($$) {
@@ -90,7 +90,7 @@ sub alternates_changed {
 
         # can't rely on 'q' on some 32-bit builds, but `d' works
         my $st = pack('dd', $st[10], $st[7]); # 10: ctime, 7: size
-        return 0 if $self->{alt_st} eq $st;
+        return 0 if ($self->{alt_st} // '') eq $st;
         $self->{alt_st} = $st; # always a true value
 }