From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C21E41F9FC for ; Thu, 18 Mar 2021 23:27:51 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] cgit: fix fallout from lazy coderepo loading Date: Thu, 18 Mar 2021 23:27:51 +0000 Message-Id: <20210318232751.10575-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 | 8 ++++++-- lib/PublicInbox/Config.pm | 4 ---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/Cgit.pm b/lib/PublicInbox/Cgit.pm index f38e8b6b..8ad07be2 100644 --- a/lib/PublicInbox/Cgit.pm +++ b/lib/PublicInbox/Cgit.pm @@ -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}; diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 1037c884..228de4ff 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -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";