about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/Config.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 3f3707ec..b5f0fcb1 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -15,9 +15,12 @@ use File::Path::Expand qw/expand_filename/;
 sub new {
         my ($class, $file) = @_;
         $file = default_file() unless defined($file);
-        my $self = bless git_config_dump($file), $class;
-        $self->{-by_addr} = {};
-        $self->{-by_name} = {};
+        $file = ref $file ? $file : git_config_dump($file);
+        my $self = bless $file, $class;
+
+        # caches
+        $self->{-by_addr} ||= {};
+        $self->{-by_name} ||= {};
         $self;
 }