lib/PublicInbox/ParentPipe.pm
lib/PublicInbox/ProcessPipe.pm
lib/PublicInbox/Qspawn.pm
+lib/PublicInbox/RepoBase.pm
+lib/PublicInbox/RepoConfig.pm
+lib/PublicInbox/RepoGit.pm
+lib/PublicInbox/RepoGitAtom.pm
+lib/PublicInbox/RepoGitBlob.pm
+lib/PublicInbox/RepoGitCommit.pm
+lib/PublicInbox/RepoGitDiff.pm
+lib/PublicInbox/RepoGitDiffCommon.pm
+lib/PublicInbox/RepoGitFallback.pm
+lib/PublicInbox/RepoGitLog.pm
+lib/PublicInbox/RepoGitPatch.pm
+lib/PublicInbox/RepoGitPlain.pm
+lib/PublicInbox/RepoGitQuery.pm
lib/PublicInbox/RepoGitSearch.pm
lib/PublicInbox/RepoGitSearchIdx.pm
+lib/PublicInbox/RepoGitSnapshot.pm
+lib/PublicInbox/RepoGitSummary.pm
+lib/PublicInbox/RepoGitTag.pm
+lib/PublicInbox/RepoGitTree.pm
+lib/PublicInbox/RepoRoot.pm
lib/PublicInbox/Repobrowse.pm
-lib/PublicInbox/RepobrowseBase.pm
-lib/PublicInbox/RepobrowseConfig.pm
-lib/PublicInbox/RepobrowseGit.pm
-lib/PublicInbox/RepobrowseGitAtom.pm
-lib/PublicInbox/RepobrowseGitBlob.pm
-lib/PublicInbox/RepobrowseGitCommit.pm
-lib/PublicInbox/RepobrowseGitDiff.pm
-lib/PublicInbox/RepobrowseGitDiffCommon.pm
-lib/PublicInbox/RepobrowseGitFallback.pm
-lib/PublicInbox/RepobrowseGitLog.pm
-lib/PublicInbox/RepobrowseGitPatch.pm
-lib/PublicInbox/RepobrowseGitPlain.pm
-lib/PublicInbox/RepobrowseGitQuery.pm
-lib/PublicInbox/RepobrowseGitSnapshot.pm
-lib/PublicInbox/RepobrowseGitSummary.pm
-lib/PublicInbox/RepobrowseGitTag.pm
-lib/PublicInbox/RepobrowseGitTree.pm
-lib/PublicInbox/RepobrowseRoot.pm
lib/PublicInbox/SaPlugin/ListMirror.pm
lib/PublicInbox/Search.pm
lib/PublicInbox/SearchIdx.pm
# Copyright (C) 2015 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-package PublicInbox::RepobrowseBase;
+package PublicInbox::RepoBase;
use strict;
use warnings;
-require PublicInbox::RepobrowseGitQuery;
+require PublicInbox::RepoGitQuery;
use PublicInbox::Hval;
our %MIME_TYPE_WHITELIST = ('application/pdf' => 1);
# Copyright (C) 2015 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-package PublicInbox::RepobrowseConfig;
+package PublicInbox::RepoConfig;
use strict;
use warnings;
use PublicInbox::Inbox;
# Copyright (C) 2015 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ (https://www.gnu.org/licenses/agpl-3.0.txt)
-# common functions used by other RepobrowseGit* modules
-package PublicInbox::RepobrowseGit;
+# common functions used by other RepoGit* modules
+package PublicInbox::RepoGit;
use strict;
use warnings;
use base qw(Exporter);
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# show log as an Atom feed
-package PublicInbox::RepobrowseGitAtom;
+package PublicInbox::RepoGitAtom;
use strict;
use warnings;
use PublicInbox::Hval qw(utf8_html);
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use PublicInbox::Qspawn;
use constant DATEFMT => '%Y-%m-%dT%H:%M:%SZ';
my $git = $repo_info->{git};
my $env = $req->{env};
- my $q =$req->{'q'} = PublicInbox::RepobrowseGitQuery->new($env);
+ my $q =$req->{'q'} = PublicInbox::RepoGitQuery->new($env);
my $h = $q->{h};
my $read_log = sub {
my $cmd = $git->cmd(qw(log --no-notes --no-color
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Show a blob as-is
-package PublicInbox::RepobrowseGitBlob;
+package PublicInbox::RepoGitBlob;
use strict;
use warnings;
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use base qw(Exporter);
our @EXPORT = qw(git_blob_mime_type git_blob_stream_response);
sub call_git_blob {
my ($self, $req) = @_;
my $git = $req->{repo_info}->{git};
- my $q = PublicInbox::RepobrowseGitQuery->new($req->{env});
+ my $q = PublicInbox::RepoGitQuery->new($req->{env});
my $id = $q->{id};
$id eq '' and $id = 'HEAD';
$id .= ":$req->{expath}";
# punish the common case with extra bytes if somebody uses 'D' or 'P'
# in filenames.
-package PublicInbox::RepobrowseGitCommit;
+package PublicInbox::RepoGitCommit;
use strict;
use warnings;
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use PublicInbox::Hval qw(utf8_html to_attr);
-use PublicInbox::RepobrowseGit qw(git_unquote git_commit_title);
-use PublicInbox::RepobrowseGitDiffCommon;
+use PublicInbox::RepoGit qw(git_unquote git_commit_title);
+use PublicInbox::RepoGitDiffCommon;
use PublicInbox::Qspawn;
use constant GIT_FMT => '--pretty=format:'.join('%n',
}
}
-sub call_git_commit { # RepobrowseBase calls this
+sub call_git_commit { # RepoBase calls this
my ($self, $req) = @_;
my $env = $req->{env};
- my $q = PublicInbox::RepobrowseGitQuery->new($env);
+ my $q = PublicInbox::RepoGitQuery->new($env);
my $id = $q->{id};
$id eq '' and $id = 'HEAD';
#
# We probably will not link to this outright because it's expensive,
# but exists to preserve URL compatibility with cgit.
-package PublicInbox::RepobrowseGitDiff;
+package PublicInbox::RepoGitDiff;
use strict;
use warnings;
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use PublicInbox::Hval qw(utf8_html);
-use PublicInbox::RepobrowseGitDiffCommon;
+use PublicInbox::RepoGitDiffCommon;
use PublicInbox::Qspawn;
sub git_diff_sed ($$) {
sub call_git_diff {
my ($self, $req) = @_;
my $env = $req->{env};
- my $q = PublicInbox::RepobrowseGitQuery->new($env);
+ my $q = PublicInbox::RepoGitQuery->new($env);
my $id = $q->{id};
my $id2 = $q->{id2};
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# common git diff-related code
-package PublicInbox::RepobrowseGitDiffCommon;
+package PublicInbox::RepoGitDiffCommon;
use strict;
use warnings;
-use PublicInbox::RepobrowseGit qw/git_unquote git_commit_title/;
+use PublicInbox::RepoGit qw/git_unquote git_commit_title/;
use PublicInbox::Hval qw/utf8_html to_attr/;
use base qw/Exporter/;
our @EXPORT = qw/git_diff_sed_init git_diff_sed_close git_diff_sed_run
# when no endpoints match, fallback to this and serve a static file
# This can serve Smart HTTP in the future.
-package PublicInbox::RepobrowseGitFallback;
+package PublicInbox::RepoGitFallback;
use strict;
use warnings;
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use PublicInbox::GitHTTPBackend;
-# overrides PublicInbox::RepobrowseBase::call
+# overrides PublicInbox::RepoBase::call
sub call {
my ($self, undef, $req) = @_;
my $expath = $req->{expath};
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# show the log view
-package PublicInbox::RepobrowseGitLog;
+package PublicInbox::RepoGitLog;
use strict;
use warnings;
use PublicInbox::Hval qw(utf8_html);
-use base qw(PublicInbox::RepobrowseBase);
-use PublicInbox::RepobrowseGit qw(git_dec_links git_commit_title);
+use base qw(PublicInbox::RepoBase);
+use PublicInbox::RepoGit qw(git_dec_links git_commit_title);
use PublicInbox::Qspawn;
# cannot rely on --date=format-local:... yet, it is too new (September 2015)
use constant STATES => qw(h p D ai an s b);
$max = int($max);
$max = 50 if $max == 0;
my $env = $req->{env};
- my $q = $req->{'q'} = PublicInbox::RepobrowseGitQuery->new($env);
+ my $q = $req->{'q'} = PublicInbox::RepoGitQuery->new($env);
my $h = $q->{h};
$h eq '' and $h = 'HEAD';
my $git = $repo_info->{git};
# shows the /patch/ endpoint for git repositories
# usage: /repo.git/patch?id=COMMIT_ID
-package PublicInbox::RepobrowseGitPatch;
+package PublicInbox::RepoGitPatch;
use strict;
use warnings;
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use PublicInbox::Qspawn;
# try to be educational and show the command-line used in the signature
my ($self, $req) = @_;
my $git = $req->{repo_info}->{git};
my $env = $req->{env};
- my $q = PublicInbox::RepobrowseGitQuery->new($env);
+ my $q = PublicInbox::RepoGitQuery->new($env);
my $id = $q->{id};
$id =~ /\A[\w-]+([~\^][~\^\d])*\z/ or $id = 'HEAD';
# Copyright (C) 2015-2016 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-package PublicInbox::RepobrowseGitPlain;
+package PublicInbox::RepoGitPlain;
use strict;
use warnings;
-use base qw(PublicInbox::RepobrowseBase);
-use PublicInbox::RepobrowseGitBlob;
+use base qw(PublicInbox::RepoBase);
+use PublicInbox::RepoGitBlob;
use PublicInbox::Hval qw(utf8_html);
use PublicInbox::Qspawn;
sub call_git_plain {
my ($self, $req) = @_;
my $git = $req->{repo_info}->{git};
- my $q = PublicInbox::RepobrowseGitQuery->new($req->{env});
+ my $q = PublicInbox::RepoGitQuery->new($req->{env});
my $id = $q->{id};
$id eq '' and $id = 'HEAD';
$id .= ":$req->{expath}";
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# query parameter management for repobrowse
-package PublicInbox::RepobrowseGitQuery;
+package PublicInbox::RepoGitQuery;
use strict;
use warnings;
use PublicInbox::Hval;
# Mainly for compatibility reasons with cgit, I'm unsure if
# showing this in a repository viewer is a good idea.
-package PublicInbox::RepobrowseGitSnapshot;
+package PublicInbox::RepoGitSnapshot;
use strict;
use warnings;
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use PublicInbox::Git;
use PublicInbox::Qspawn;
our $SUFFIX;
'zip' => 'application/x-zip',
);
-sub call_git_snapshot ($$) { # invoked by PublicInbox::RepobrowseBase::call
+sub call_git_snapshot ($$) { # invoked by PublicInbox::RepoBase::call
my ($self, $req) = @_;
my @extra = @{$req->{extra}};
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# The main summary/landing page of a git repository viewer
-package PublicInbox::RepobrowseGitSummary;
+package PublicInbox::RepoGitSummary;
use strict;
use warnings;
use PublicInbox::Hval qw(utf8_html);
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use PublicInbox::Qspawn;
sub call_git_summary {
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# shows the /tag/ endpoint for git repositories
-package PublicInbox::RepobrowseGitTag;
+package PublicInbox::RepoGitTag;
use strict;
use warnings;
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use POSIX qw(strftime);
use PublicInbox::Hval qw(utf8_html);
use PublicInbox::Qspawn;
sub call_git_tag {
my ($self, $req) = @_;
- my $q = PublicInbox::RepobrowseGitQuery->new($req->{env});
+ my $q = PublicInbox::RepoGitQuery->new($req->{env});
my $h = $q->{h};
$h eq '' and return git_tag_list($self, $req);
sub {
# Copyright (C) 2015 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-package PublicInbox::RepobrowseGitTree;
+package PublicInbox::RepoGitTree;
use strict;
use warnings;
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use PublicInbox::Hval qw(utf8_html);
use PublicInbox::Qspawn;
my ($self, $req) = @_;
my @extra = @{$req->{extra}};
my $git = $req->{repo_info}->{git};
- my $q = PublicInbox::RepobrowseGitQuery->new($req->{env});
+ my $q = PublicInbox::RepoGitQuery->new($req->{env});
my $id = $q->{id};
if ($id eq '') {
chomp($id = $git->qx(qw(rev-parse --short=10 HEAD)));
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# displays the root '/' where all the projects lie
-package PublicInbox::RepobrowseRoot;
+package PublicInbox::RepoRoot;
use strict;
use warnings;
-use base qw(PublicInbox::RepobrowseBase);
+use base qw(PublicInbox::RepoBase);
use PublicInbox::Hval qw(utf8_html);
sub call {
use strict;
use warnings;
use URI::Escape qw(uri_escape_utf8 uri_unescape);
-use PublicInbox::RepobrowseConfig;
+use PublicInbox::RepoConfig;
my %CMD = map { lc($_) => $_ } qw(Log Commit Tree Patch Blob Plain Tag Atom
Diff Snapshot);
sub new {
my ($class, $rconfig) = @_;
- $rconfig ||= PublicInbox::RepobrowseConfig->new;
+ $rconfig ||= PublicInbox::RepoConfig->new;
bless { rconfig => $rconfig }, $class;
}
sub root_index {
my ($self) = @_;
- my $mod = load_once('PublicInbox::RepobrowseRoot');
- $mod->new->call($self->{rconfig}); # RepobrowseRoot::call
+ my $mod = load_once('PublicInbox::RepoRoot');
+ $mod->new->call($self->{rconfig}); # RepoRoot::call
}
sub call {
return $self->root_index($self) unless length($repo_path);
- my $rconfig = $self->{rconfig}; # RepobrowseConfig
+ my $rconfig = $self->{rconfig}; # RepoConfig
my $repo_info;
until ($repo_info = $rconfig->lookup($repo_path)) {
my $p = shift @extra or last;
return no_tslash($env) if ($tslash && $NO_TSLASH{$mod});
$req->{tslash} = $tslash;
- $mod = load_once("PublicInbox::Repobrowse$vcs$mod");
+ $mod = load_once("PublicInbox::Repo$vcs$mod");
$vcs = load_once("PublicInbox::$vcs");
# $repo_info->{git} ||= PublicInbox::Git->new(...)
$repo_info->{$vcs_lc} ||= $vcs->new($repo_info->{path});
$req->{expath} = join('/', @extra);
- my $rv = eval { $mod->new->call($cmd, $req) }; # RepobrowseBase::call
+ my $rv = eval { $mod->new->call($cmd, $req) }; # RepoBase::call
$rv || r404();
}
use strict;
use warnings;
use Test::More;
-use PublicInbox::RepobrowseGit qw(git_unquote);
+use PublicInbox::RepoGit qw(git_unquote);
is("foo\nbar", git_unquote('"foo\\nbar"'), 'unquoted newline');
is("Eléanor", git_unquote('"El\\303\\251anor"'), 'unquoted octal');