]> Sergey Matveev's repositories - public-inbox.git/commitdiff
cgit: fix fallout from lazy coderepo loading
authorEric Wong <e@80x24.org>
Thu, 18 Mar 2021 23:27:51 +0000 (23:27 +0000)
committerEric Wong <e@80x24.org>
Fri, 19 Mar 2021 06:08:24 +0000 (06:08 +0000)
We can't completely instantiate our cgit wrapper without knowing
knowing cgit locations for serving static content.

Fixes: a5968dc059f655a ("config: lazy-load coderepos, support extindex")
lib/PublicInbox/Cgit.pm
lib/PublicInbox/Config.pm

index f38e8b6b68d2e8501b03e1baf7d481b7ebda5514..8ad07be227345e2d15269128bb46718e0737c8ab 100644 (file)
@@ -53,14 +53,18 @@ sub locate_cgit ($) {
 sub new {
        my ($class, $pi_cfg) = @_;
        my ($cgit_bin, $cgit_data) = locate_cgit($pi_cfg);
-
+       # TODO: support gitweb and other repository viewers?
+       if (defined(my $cgitrc = $pi_cfg->{-cgitrc_unparsed})) {
+               $pi_cfg->parse_cgitrc($cgitrc, 0);
+       }
        my $self = bless {
                cmd => [ $cgit_bin ],
                cgit_data => $cgit_data,
                pi_cfg => $pi_cfg,
        }, $class;
 
-       $pi_cfg->fill_all; # fill in -code_repos mapped to inboxes
+       # fill in -code_repos mapped to inboxes
+       $pi_cfg->each_inbox($pi_cfg->can('repo_objs'));
 
        # some cgit repos may not be mapped to inboxes, so ensure those exist:
        my $code_repos = $pi_cfg->{-code_repos};
index 1037c88495b92d05f012c3e85908ec5b1aaf451b..228de4ffe88f631fbccbaee594087a8680adcafd 100644 (file)
@@ -323,10 +323,6 @@ sub _fill_code_repo {
        my ($self, $nick) = @_;
        my $pfx = "coderepo.$nick";
 
-       # TODO: support gitweb and other repository viewers?
-       if (defined(my $cgitrc = delete $self->{-cgitrc_unparsed})) {
-               parse_cgitrc($self, $cgitrc, 0);
-       }
        my $dir = $self->{"$pfx.dir"}; # aka "GIT_DIR"
        unless (defined $dir) {
                warn "$pfx.dir unset\n";