diff options
author | Eric Wong <e@80x24.org> | 2017-02-17 03:31:16 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-02-17 03:31:16 +0000 |
commit | 8d83eab9d95348e996a2d1f92d970ddc0bf4f85b (patch) | |
tree | eb71f3f484084b2c1b4bc50446ad035e8b95e111 | |
parent | e7dc3224ad0b497da6ef242e3a9c612c5702514e (diff) | |
download | public-inbox-8d83eab9d95348e996a2d1f92d970ddc0bf4f85b.tar.gz |
This name is shorter and matches terminology in gitweb and other popular git web viewers.
-rw-r--r-- | MANIFEST | 4 | ||||
-rw-r--r-- | lib/PublicInbox/RepoGitRaw.pm (renamed from lib/PublicInbox/RepoGitPlain.pm) | 10 | ||||
-rw-r--r-- | lib/PublicInbox/RepoGitTree.pm | 10 | ||||
-rw-r--r-- | lib/PublicInbox/Repobrowse.pm | 4 | ||||
-rw-r--r-- | t/repobrowse_git_raw.t (renamed from t/repobrowse_git_plain.t) | 4 |
5 files changed, 16 insertions, 16 deletions
@@ -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 diff --git a/lib/PublicInbox/RepoGitPlain.pm b/lib/PublicInbox/RepoGitRaw.pm index 8aff2177..ce6d7e73 100644 --- a/lib/PublicInbox/RepoGitPlain.pm +++ b/lib/PublicInbox/RepoGitRaw.pm @@ -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) { diff --git a/lib/PublicInbox/RepoGitTree.pm b/lib/PublicInbox/RepoGitTree.pm index a4add619..5b428da0 100644 --- a/lib/PublicInbox/RepoGitTree.pm +++ b/lib/PublicInbox/RepoGitTree.pm @@ -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); diff --git a/lib/PublicInbox/Repobrowse.pm b/lib/PublicInbox/Repobrowse.pm index 34ffd542..de5bd364 100644 --- a/lib/PublicInbox/Repobrowse.pm +++ b/lib/PublicInbox/Repobrowse.pm @@ -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); diff --git a/t/repobrowse_git_plain.t b/t/repobrowse_git_raw.t index a93fa10e..2048d82a 100644 --- a/t/repobrowse_git_plain.t +++ b/t/repobrowse_git_raw.t @@ -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'); |