user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/3] www: respect coderepo.*.url during cgit init
Date: Sat, 23 Oct 2021 20:19:39 +0000	[thread overview]
Message-ID: <20211023201939.27183-4-e@80x24.org> (raw)
In-Reply-To: <20211023201939.27183-1-e@80x24.org>

This is necessary for showing "found $OID in $CODEREPO_URL"
in solver-generated pages ($INBOX_URL/$OID/s/).
---
 lib/PublicInbox/Cgit.pm   | 5 +----
 lib/PublicInbox/Config.pm | 7 +++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/PublicInbox/Cgit.pm b/lib/PublicInbox/Cgit.pm
index 8ad07be2..cc729aa2 100644
--- a/lib/PublicInbox/Cgit.pm
+++ b/lib/PublicInbox/Cgit.pm
@@ -63,15 +63,12 @@ sub new {
 		pi_cfg => $pi_cfg,
 	}, $class;
 
-	# 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};
 	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;
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index f2e5d5f0..41117ac5 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -323,9 +323,8 @@ sub parse_cgitrc {
 	cgit_repo_merge($self, $repo->{dir}, $repo) if $repo;
 }
 
-# parse a code repo
-# Only git is supported at the moment, but SVN and Hg are possibilities
-sub _fill_code_repo {
+# parse a code repo, only git is supported at the moment
+sub fill_code_repo {
 	my ($self, $nick) = @_;
 	my $pfx = "coderepo.$nick";
 	my $dir = $self->{"$pfx.dir"} // do { # aka "GIT_DIR"
@@ -392,7 +391,7 @@ sub repo_objs {
 				next;
 			}
 			my $repo = $code_repos->{$nick} //=
-						_fill_code_repo($self, $nick);
+						fill_code_repo($self, $nick);
 			push @repo_objs, $repo if $repo;
 		}
 		if (scalar @repo_objs) {

      parent reply	other threads:[~2021-10-23 20:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-23 20:19 [PATCH 0/3] www: coderepo-related cleanups + fixes Eric Wong
2021-10-23 20:19 ` [PATCH 1/3] git: simplify local_nick, avoid "foo.git.git" Eric Wong
2021-10-23 20:19 ` [PATCH 2/3] config: remove *_url_format support for cgit Eric Wong
2021-10-23 20:19 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211023201939.27183-4-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).