]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: improve API consistency, harder
authorEric Wong <e@80x24.org>
Mon, 7 Mar 2016 08:10:58 +0000 (08:10 +0000)
committerEric Wong <e@80x24.org>
Tue, 5 Apr 2016 18:58:27 +0000 (18:58 +0000)
This allows RepobrowseConfig objects to passed directly
to Repobrowse initialization, similar to the way the normal
Config can be passed to WWW at initialization.

lib/PublicInbox/Repobrowse.pm

index fe06a5befb0552a883a1aaf3f7c9af517e4ce6f3..0b09800bcd5f7a5120a7fcd4a61464e74afc4756 100644 (file)
@@ -29,8 +29,9 @@ my %VCS = (git => 'Git');
 my %LOADED;
 
 sub new {
-       my ($class, $file) = @_;
-       bless { rconfig => PublicInbox::RepobrowseConfig->new($file) }, $class;
+       my ($class, $rconfig) = @_;
+       $rconfig ||= PublicInbox::RepobrowseConfig->new;
+       bless { rconfig => $rconfig }, $class;
 }
 
 # simple response for errors