]> Sergey Matveev's repositories - public-inbox.git/commitdiff
cgit: type declaration for PublicInbox::Git
authorEric Wong <e@80x24.org>
Tue, 31 Dec 2019 10:30:13 +0000 (10:30 +0000)
committerEric Wong <e@80x24.org>
Wed, 1 Jan 2020 07:51:04 +0000 (07:51 +0000)
AFAIK this doesn't do anything for Perl internally since
PublicInbox::Git doesn't "use fields", but it makes it easier for
humans readers to follow and ensure we're not passing unblessed
or non-ref scalars to PublicInbox::GitHTTPBackend::serve.

lib/PublicInbox/Cgit.pm

index ab4065bd258ecc65a8bbd186e412f4de030dab48..3623943882fdb9f95a50c90d0d397497606af4a9 100644 (file)
@@ -8,6 +8,7 @@
 package PublicInbox::Cgit;
 use strict;
 use PublicInbox::GitHTTPBackend;
+use PublicInbox::Git;
 # not bothering with Exporter for a one-off
 *r = *PublicInbox::GitHTTPBackend::r;
 *input_prepare = *PublicInbox::GitHTTPBackend::input_prepare;
@@ -109,7 +110,7 @@ sub call {
        # handle requests without spawning cgit iff possible:
        if ($path_info =~ m!\A/(.+?)/($PublicInbox::GitHTTPBackend::ANY)\z!ox) {
                my ($nick, $path) = ($1, $2);
-               if (my $git = $self->{"\0$nick"}) {
+               if (my PublicInbox::Git $git = $self->{"\0$nick"}) {
                        return serve($env, $git, $path);
                }
        } elsif ($path_info =~ m!$self->{static}! &&