about summary refs log tree commit homepage
path: root/lib/PublicInbox/Cgit.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-10-04 19:12:35 +0000
committerEric Wong <e@80x24.org>2022-10-05 21:15:26 +0000
commit6dec9bf8c0e1b859703d7a5dfb87052cf4e87846 (patch)
tree7d0e0c7bf96da3a3fe494eaaaaf1c714b5aa1775 /lib/PublicInbox/Cgit.pm
parenta002384a74382df2649d6a1f8dfba4f291af032e (diff)
downloadpublic-inbox-6dec9bf8c0e1b859703d7a5dfb87052cf4e87846.tar.gz
This will allow it to easily map a single coderepo to multiple
inboxes (or multiple coderepos to any number of inboxes).
For now, this is just a summary, but $REPO/$OID/s/ support
will be added, along with archive downloads.

Indexing of coderepos will probably be supported via -extindex,
only.
Diffstat (limited to 'lib/PublicInbox/Cgit.pm')
-rw-r--r--lib/PublicInbox/Cgit.pm14
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/PublicInbox/Cgit.pm b/lib/PublicInbox/Cgit.pm
index a63f8902..1112d9f8 100644
--- a/lib/PublicInbox/Cgit.pm
+++ b/lib/PublicInbox/Cgit.pm
@@ -7,6 +7,7 @@
 
 package PublicInbox::Cgit;
 use v5.12;
+use parent qw(PublicInbox::WwwCoderepo);
 use PublicInbox::GitHTTPBackend;
 use PublicInbox::Git;
 # not bothering with Exporter for a one-off
@@ -52,10 +53,6 @@ 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,
@@ -63,14 +60,7 @@ sub new {
         }, $class;
 
         # some cgit repos may not be mapped to inboxes, so ensure those exist:
-        my $code_repos = $pi_cfg->{-code_repos};
-        for my $k (grep(/\Acoderepo\.(?:.+)\.dir\z/, keys %$pi_cfg)) {
-                $k = substr($k, length('coderepo.'), -length('.dir'));
-                $code_repos->{$k} //= $pi_cfg->fill_code_repo($k);
-        }
-        while (my ($nick, $repo) = each %$code_repos) {
-                $self->{"\0$nick"} = $repo;
-        }
+        PublicInbox::WwwCoderepo::prepare_coderepos($self);
         my $s = join('|', map { quotemeta } keys %{$pi_cfg->{-cgit_static}});
         $self->{static} = qr/\A($s)\z/;
         $self;