]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: rename "plain" endpoint to "raw"
authorEric Wong <e@80x24.org>
Fri, 17 Feb 2017 03:31:16 +0000 (03:31 +0000)
committerEric Wong <e@80x24.org>
Fri, 17 Feb 2017 03:31:16 +0000 (03:31 +0000)
This name is shorter and matches terminology in gitweb and
other popular git web viewers.

MANIFEST
lib/PublicInbox/RepoGitRaw.pm [moved from lib/PublicInbox/RepoGitPlain.pm with 94% similarity]
lib/PublicInbox/RepoGitTree.pm
lib/PublicInbox/Repobrowse.pm
t/repobrowse_git_raw.t [moved from t/repobrowse_git_plain.t with 87% similarity]

index bced28046e8787802e054e59f84b6fdd5b8e0d99..495a63e6e24d84adb495761fd04aa66180c5ca0c 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -92,8 +92,8 @@ 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/RepoGitRaw.pm
 lib/PublicInbox/RepoGitSearch.pm
 lib/PublicInbox/RepoGitSearchIdx.pm
 lib/PublicInbox/RepoGitSnapshot.pm
@@ -195,7 +195,7 @@ t/repobrowse_git_atom.t
 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
similarity index 94%
rename from lib/PublicInbox/RepoGitPlain.pm
rename to lib/PublicInbox/RepoGitRaw.pm
index 8aff2177c4209094a46bb42a5db9d9a7a41fdc62..ce6d7e730aa766cd1d5d1f274ddf46ce0a5a1524 100644 (file)
@@ -1,6 +1,6 @@
 # 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);
@@ -8,7 +8,7 @@ use PublicInbox::RepoGitBlob;
 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};
@@ -24,7 +24,7 @@ sub call_git_plain {
                $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';
        }
@@ -59,14 +59,14 @@ sub git_tree_sed ($) {
 
 # 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) {
index a4add6198d32acb59e3191a8b9e814abf2c9d0b1..5b428da04c4e010089f3c2b7e5197531dc494863 100644 (file)
@@ -83,16 +83,16 @@ sub git_blob_show {
        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;
@@ -172,7 +172,7 @@ sub git_tree_sed ($) {
                        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);
index 34ffd5426c41d37675c12fedfa1ac4b4ca5f2cba..de5bd3640c284bbbd3dcb323e4af1698c7c32915 100644 (file)
@@ -23,7 +23,7 @@ use warnings;
 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;
@@ -57,7 +57,7 @@ sub base_url ($) {
 
 # 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);
similarity index 87%
rename from t/repobrowse_git_plain.t
rename to t/repobrowse_git_raw.t
index a93fa10e8095cc352963e35df02cfeae90f703c8..2048d82a8fa618ceedf11bb31fca6d46a9f6ec89 100644 (file)
@@ -7,7 +7,7 @@ my $test = require './t/repobrowse_common_git.perl';
 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);
@@ -20,7 +20,7 @@ test_psgi($test->{app}, sub {
        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');