X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FWwwCoderepo.pm;h=7f8b34597b62a5d4069a6fecdf483da35483a43e;hb=1802dc29bda25a5478787d3d7a8a3c2de6cc6797;hp=3c9292226b964857b6c9a12337c057f598fd2614;hpb=f0d445048bc5d3de05a963d9a024279a93152c1f;p=public-inbox.git diff --git a/lib/PublicInbox/WwwCoderepo.pm b/lib/PublicInbox/WwwCoderepo.pm index 3c929222..7f8b3459 100644 --- a/lib/PublicInbox/WwwCoderepo.pm +++ b/lib/PublicInbox/WwwCoderepo.pm @@ -49,9 +49,6 @@ sub prepare_coderepos { $pi_cfg->repo_objs($eidx); push @{$self->{-strong}}, $eidx; # strengthen {-ibxs} weakref } - while (my ($nick, $repo) = each %$code_repos) { - $self->{"\0$nick"} = $repo; - } } sub new { @@ -211,30 +208,31 @@ sub srv { # endpoint called by PublicInbox::WWW my $path_info = $ctx->{env}->{PATH_INFO}; my $git; # handle clone requests + my $cr = $self->{pi_cfg}->{-code_repos}; if ($path_info =~ m!\A/(.+?)/($PublicInbox::GitHTTPBackend::ANY)\z!x) { - $git = $self->{"\0$1"} and return + $git = $cr->{$1} and return PublicInbox::GitHTTPBackend::serve($ctx->{env},$git,$2); } $path_info =~ m!\A/(.+?)/\z! and - ($ctx->{git} = $self->{"\0$1"}) and return summary($self, $ctx); + ($ctx->{git} = $cr->{$1}) and return summary($self, $ctx); $path_info =~ m!\A/(.+?)/([a-f0-9]+)/s/\z! and - ($ctx->{git} = $self->{"\0$1"}) and + ($ctx->{git} = $cr->{$1}) and return PublicInbox::ViewVCS::show($ctx, $2); # snapshots: if ($path_info =~ m!\A/(.+?)/snapshot/([^/]+)\z! and - ($ctx->{git} = $self->{"\0$1"})) { + ($ctx->{git} = $cr->{$1})) { $ctx->{wcr} = $self; return PublicInbox::RepoSnapshot::srv($ctx, $2) // r(404); } if ($path_info =~ m!\A/(.+?)/atom/(.*)\z! and - ($ctx->{git} = $self->{"\0$1"})) { + ($ctx->{git} = $cr->{$1})) { return PublicInbox::RepoAtom::srv_atom($ctx, $2) // r(404); } # enforce trailing slash: - if ($path_info =~ m!\A/(.+?)\z! and ($git = $self->{"\0$1"})) { + if ($path_info =~ m!\A/(.+?)\z! and ($git = $cr->{$1})) { my $qs = $ctx->{env}->{QUERY_STRING}; my $url = $git->base_url($ctx->{env}); $url .= "?$qs" if $qs ne '';