diff options
Diffstat (limited to 'lib/PublicInbox/Config.pm')
-rw-r--r-- | lib/PublicInbox/Config.pm | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 533f4a52..9f764c32 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -24,21 +24,14 @@ sub _array ($) { ref($_[0]) eq 'ARRAY' ? $_[0] : [ $_[0] ] } sub new { my ($class, $file, $lei) = @_; $file //= default_file(); - my $self; - my $set_dedupe; - if (ref($file) eq 'SCALAR') { # used by some tests - open my $fh, '<', $file or die; # PerlIO::scalar - $self = config_fh_parse($fh, "\n", '='); - bless $self, $class; - } else { - if (-f $file && $DEDUPE) { - $file = rel2abs_collapsed($file); - $self = $DEDUPE->{$file} and return $self; - $set_dedupe = 1; - } - $self = git_config_dump($class, $file, $lei); - $self->{'-f'} = $file; - } + my ($self, $set_dedupe); + if (-f $file && $DEDUPE) { + $file = rel2abs_collapsed($file); + $self = $DEDUPE->{$file} and return $self; + $set_dedupe = 1; + } + $self = git_config_dump($class, $file, $lei); + $self->{-f} = $file; # caches $self->{-by_addr} = {}; $self->{-by_list_id} = {}; |