From: Eric Wong Date: Fri, 17 Feb 2017 03:31:16 +0000 (+0000) Subject: repobrowse: rename "plain" endpoint to "raw" X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d83eab9d95348e996a2d1f92d970ddc0bf4f85b;p=thirdparty%2Fpublic-inbox.git repobrowse: rename "plain" endpoint to "raw" This name is shorter and matches terminology in gitweb and other popular git web viewers. --- diff --git a/MANIFEST b/MANIFEST index bced28046..495a63e6e 100644 --- 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 diff --git a/lib/PublicInbox/RepoGitPlain.pm b/lib/PublicInbox/RepoGitRaw.pm similarity index 94% rename from lib/PublicInbox/RepoGitPlain.pm rename to lib/PublicInbox/RepoGitRaw.pm index 8aff2177c..ce6d7e730 100644 --- a/lib/PublicInbox/RepoGitPlain.pm +++ b/lib/PublicInbox/RepoGitRaw.pm @@ -1,6 +1,6 @@ # Copyright (C) 2015-2016 all contributors # License: AGPL-3.0+ -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
 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 = "

$title

    "; if (@ex) { if ($tslash) { diff --git a/lib/PublicInbox/RepoGitTree.pm b/lib/PublicInbox/RepoGitTree.pm index a4add6198..5b428da04 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 (raw)}; + $s .= qq{\t$$left bytes (raw)}; $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 = "$path" } $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$path\n); diff --git a/lib/PublicInbox/Repobrowse.pm b/lib/PublicInbox/Repobrowse.pm index 34ffd5426..de5bd3640 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 similarity index 87% rename from t/repobrowse_git_plain.t rename to t/repobrowse_git_raw.t index a93fa10e8..2048d82a8 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}, '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');