]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Cgit.pm
www: drop --subject from "git send-email" instructions
[public-inbox.git] / lib / PublicInbox / Cgit.pm
index 472509a80852f398ecee8f598c896127d923992d..cc729aa286f4bf126de8f7093dab1c37d0b480a2 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2019-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # wrapper for cgit(1) and git-http-backend(1) for browsing and
@@ -53,21 +53,22 @@ 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
-
        # some cgit repos may not be mapped to inboxes, so ensure those exist:
        my $code_repos = $pi_cfg->{-code_repos};
        foreach my $k (keys %$pi_cfg) {
                $k =~ /\Acoderepo\.(.+)\.dir\z/ or next;
                my $dir = $pi_cfg->{$k};
-               $code_repos->{$1} ||= PublicInbox::Git->new($dir);
+               $code_repos->{$1} ||= $pi_cfg->fill_code_repo($1);
        }
        while (my ($nick, $repo) = each %$code_repos) {
                $self->{"\0$nick"} = $repo;