lib/PublicInbox/RepoGitFallback.pm
lib/PublicInbox/RepoGitLog.pm
lib/PublicInbox/RepoGitPatch.pm
-lib/PublicInbox/RepoGitPlain.pm
lib/PublicInbox/RepoGitQuery.pm
+lib/PublicInbox/RepoGitRaw.pm
lib/PublicInbox/RepoGitSearch.pm
lib/PublicInbox/RepoGitSearchIdx.pm
lib/PublicInbox/RepoGitSnapshot.pm
t/repobrowse_git_commit.t
t/repobrowse_git_httpd.t
t/repobrowse_git_log.t
-t/repobrowse_git_plain.t
+t/repobrowse_git_raw.t
t/repobrowse_git_snapshot.t
t/repobrowse_git_tree.t
t/search.t
# 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::RepoGitPlain;
+package PublicInbox::RepoGitRaw;
use strict;
use warnings;
use base qw(PublicInbox::RepoBase);
use PublicInbox::Hval qw(utf8_html);
use PublicInbox::Qspawn;
-sub call_git_plain {
+sub call_git_raw {
my ($self, $req) = @_;
my $repo = $req->{-repo};
my $git = $repo->{git};
$type = 'text/plain';
} elsif ($type eq 'tree') {
$git->cat_file_finish($left);
- return git_tree_plain($req, $git, $hex);
+ return git_tree_raw($req, $git, $hex);
} else {
$type = 'application/octet-stream';
}
# This should follow the cgit DOM structure in case anybody depends on it,
# not using <pre> here as we don't expect people to actually view it much
-sub git_tree_plain {
+sub git_tree_raw {
my ($req, $git, $hex) = @_;
my @ex = @{$req->{extra}};
my $rel = $req->{relcmd};
my $title = utf8_html(join('/', '', @ex, ''));
my $tslash = $req->{tslash};
- my $pfx = $tslash ? './' : 'plain/';
+ my $pfx = $tslash ? './' : 'raw/';
my $t = "<h2>$title</h2><ul>";
if (@ex) {
if ($tslash) {
my $n = 0;
my $rel = $req->{relcmd};
- my $plain = join('/',
- "${rel}plain", $req->{-repo}->tip, @{$req->{extra}});
- $plain = PublicInbox::Hval->utf8($plain)->as_path;
+ my $raw = join('/',
+ "${rel}raw", $req->{-repo}->tip, @{$req->{extra}});
+ $raw = PublicInbox::Hval->utf8($raw)->as_path;
my $t = cur_path($req);
my $s = qq{\npath: $t\n\nblob $hex};
my $end = '';
$git->cat_file($hex, sub {
my ($cat, $left) = @_; # $$left == $size
- $s .= qq{\t$$left bytes (<a\nhref="$plain">raw</a>)};
+ $s .= qq{\t$$left bytes (<a\nhref="$raw">raw</a>)};
$to_read = $$left if $to_read > $$left;
my $r = read($cat, my $buf, $to_read);
return unless defined($r) && $r > 0;
elsif ($m eq 'l') { $path = "<i>$path</i>" }
$s =~ s/\s+//g;
- # 'plain' and 'log' links intentionally omitted
+ # 'raw' and 'log' links intentionally omitted
# for brevity and speed
$dst .= qq($m\t).
qq($s\t<a\nhref="$pfx/$ref">$path</a>\n);
use URI::Escape qw(uri_escape_utf8);
use PublicInbox::RepoConfig;
-my %CMD = map { lc($_) => $_ } qw(Log Commit Tree Patch Blob Plain Tag Atom
+my %CMD = map { lc($_) => $_ } qw(Log Commit Tree Patch Blob Raw Tag Atom
Diff Snapshot);
my %VCS = (git => 'Git');
my %LOADED;
# Remove trailing slash in URLs which regular humans are likely to read
# in an attempt to improve cache hit ratios. Do not redirect
-# plain|patch|blob|fallback endpoints since those could be using
+# raw|patch|blob|fallback endpoints since those could be using
# automated tools which may not follow redirects automatically
# (e.g. curl does not follow 301 unless given "-L")
my %NO_TSLASH = map { $_ => 1 } qw(Log Commit Tree Summary Tag);
test_psgi($test->{app}, sub {
my ($cb) = @_;
- my $req = 'http://example.com/test.git/plain/master/dir';
+ my $req = 'http://example.com/test.git/raw/master/dir';
my $res = $cb->(GET($req));
is(200, $res->code, 'got 200 response from dir');
my $noslash_body = dechunk($res);
my $slash_body = dechunk($r2);
like($slash_body, qr{href="\./dur\">dur</a></li>}, 'path ok w/ slash');
- $req = 'http://example.com/test.git/plain/master/foo.txt';
+ $req = 'http://example.com/test.git/raw/master/foo.txt';
my $blob = $cb->(GET($req));
like($blob->header('Content-Type'), qr!\Atext/plain\b!,
'got text/plain blob');