about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-03-02 23:39:49 +0000
committerEric Wong <e@80x24.org>2017-03-02 23:39:49 +0000
commit16b1fbe36cc39a351ef9810b9018d36df833a941 (patch)
tree6a354e1ab5177993fb11bd5ae0e43400d66ffbce /lib
parenta4df292ed39f6e02a7d57326f291583339cb562d (diff)
downloadpublic-inbox-16b1fbe36cc39a351ef9810b9018d36df833a941.tar.gz
This is shorter, and makes more sense as the endpoint
displays both tree listings and actual blob sources.
This will also make rewriting existing URLs from cgit
installations easier.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/RepoGitCommit.pm6
-rw-r--r--lib/PublicInbox/RepoGitDiffCommon.pm8
-rw-r--r--lib/PublicInbox/RepoGitSrc.pm (renamed from lib/PublicInbox/RepoGitTree.pm)10
-rw-r--r--lib/PublicInbox/RepoGitSummary.pm4
-rw-r--r--lib/PublicInbox/Repobrowse.pm4
5 files changed, 16 insertions, 16 deletions
diff --git a/lib/PublicInbox/RepoGitCommit.pm b/lib/PublicInbox/RepoGitCommit.pm
index 34f7acc3..8add3006 100644
--- a/lib/PublicInbox/RepoGitCommit.pm
+++ b/lib/PublicInbox/RepoGitCommit.pm
@@ -40,7 +40,7 @@ sub commit_header {
         my $rel = $req->{relcmd};
         my $x = $self->html_start($req, $s) . "\n" .
                 qq(   commit $H (<a\nhref="${rel}patch/$H">patch</a>)\n) .
-                qq(     tree <a\nrel=nofollow\nhref="${rel}tree/$H">$t</a>);
+                qq(     tree <a\nrel=nofollow\nhref="${rel}src/$H">$t</a>);
 
         my $git = $req->{-repo}->{git};
         # extra show path information, if any
@@ -55,7 +55,7 @@ sub commit_header {
                         my $e = PublicInbox::Hval->utf8($_, join('/', @t));
                         $ep = $e->as_path;
                         my $eh = $e->as_html;
-                        $ep = "${rel}tree/$ep/$H";
+                        $ep = "${rel}src/$ep/$H";
                         qq(<a\nrel=nofollow\nhref="$ep">$eh</a>);
                 } @$extra);
                 $path = "/$ep";
@@ -185,7 +185,7 @@ sub show_unchanged {
                 $p = $p->as_path;
                 $fn = utf8_html($fn);
                 $$dst .= qq(\t<a\nrel=nofollow);
-                $$dst .= qq(\nid="$anchor"\nhref="${rel}tree/$p">);
+                $$dst .= qq(\nid="$anchor"\nhref="${rel}src/$p">);
                 $$dst .= "$fn</a>\n";
         }
 }
diff --git a/lib/PublicInbox/RepoGitDiffCommon.pm b/lib/PublicInbox/RepoGitDiffCommon.pm
index 46e243ed..b60a5fbc 100644
--- a/lib/PublicInbox/RepoGitDiffCommon.pm
+++ b/lib/PublicInbox/RepoGitDiffCommon.pm
@@ -68,7 +68,7 @@ sub git_diff_ab_hunk ($$$$) {
                 $na = defined $na ? "#n$na" : '';
                 my $p = $req->{p}->[0];
                 $rv .= qq(<a\nrel=nofollow);
-                $rv .= qq(\nhref="${rel}tree/$p/$req->{path_a}$na">);
+                $rv .= qq(\nhref="${rel}src/$p/$req->{path_a}$na">);
                 $rv .= "$ca</a>";
         }
         $rv .= ' ';
@@ -77,7 +77,7 @@ sub git_diff_ab_hunk ($$$$) {
         } else {
                 $nb = defined $nb ? "#n$nb" : '';
                 $rv .= qq(<a\nrel=nofollow);
-                $rv .= qq(\nhref="${rel}tree/$req->{-tip}/$req->{path_b}$nb">);
+                $rv .= qq(\nhref="${rel}src/$req->{-tip}/$req->{path_b}$nb">);
                 $rv .= "$cb</a>";
         }
         $rv . ' @@' . utf8_html($ctx);
@@ -121,14 +121,14 @@ sub git_diff_cc_hunk {
                 }
         }
 
-        # we can use the normal 'tree' endpoint for the result
+        # we can use the normal 'src' endpoint for the result
         my ($n) = ($last =~ /\A\+(\d+)/); # line number
         if ($n == 0) { # deleted file (does this happen with --cc?)
                 $rv .= " $last";
         } else {
                 my $H = $req->{H};
                 $rv .= qq( <a\nrel=nofollow);
-                $rv .= qq(\nhref="${rel}tree/$H/$path#n$n">$last</a>);
+                $rv .= qq(\nhref="${rel}src/$H/$path#n$n">$last</a>);
         }
         $rv .= " $at" . utf8_html($ctx);
 }
diff --git a/lib/PublicInbox/RepoGitTree.pm b/lib/PublicInbox/RepoGitSrc.pm
index e8c34a69..1546830f 100644
--- a/lib/PublicInbox/RepoGitTree.pm
+++ b/lib/PublicInbox/RepoGitSrc.pm
@@ -1,6 +1,6 @@
 # Copyright (C) 2015 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-package PublicInbox::RepoGitTree;
+package PublicInbox::RepoGitSrc;
 use strict;
 use warnings;
 use base qw(PublicInbox::RepoBase);
@@ -19,7 +19,7 @@ my $BINARY_MSG = "Binary file, save using the 'raw' link above";
 my $MAX_ASYNC = 65536; # same as pipe size on Linux
 my $BIN_DETECT = 8000; # same as git (buffer_is_binary in git.git)
 
-sub call_git_tree {
+sub call_git_src {
         my ($self, $req) = @_;
         my $repo = $req->{-repo};
         my $git = $repo->{git};
@@ -63,7 +63,7 @@ sub cur_path {
         my $rel = $req->{relcmd};
         # avoid relative paths, here, we don't want to propagate
         # trailing-slash URLs although we tolerate them
-        $s = "<a\nhref=\"${rel}tree/$tip\">root</a>/";
+        $s = "<a\nhref=\"${rel}src/$tip\">root</a>/";
         my $cur = pop @ex;
         my @t;
         $s .= join('/', (map {
@@ -71,7 +71,7 @@ sub cur_path {
                 my $e = PublicInbox::Hval->utf8($_, join('/', @t));
                 my $ep = $e->as_path;
                 my $eh = $e->as_html;
-                "<a\nhref=\"${rel}tree/$tip/$ep\">$eh</a>";
+                "<a\nhref=\"${rel}src/$tip/$ep\">$eh</a>";
         } @ex), '<b>'.utf8_html($cur).'</b>');
 }
 
@@ -230,7 +230,7 @@ sub git_tree_show {
         } elsif (defined(my $tip = $req->{tip})) {
                 $pfx = $tip;
         } else {
-                $pfx = 'tree/' . $req->{-repo}->tip;
+                $pfx = 'src/' . $req->{-repo}->tip;
         }
         $req->{tpfx} = $pfx;
         my $env = $req->{env};
diff --git a/lib/PublicInbox/RepoGitSummary.pm b/lib/PublicInbox/RepoGitSummary.pm
index 5eb8087d..96ae9be9 100644
--- a/lib/PublicInbox/RepoGitSummary.pm
+++ b/lib/PublicInbox/RepoGitSummary.pm
@@ -84,14 +84,14 @@ sub readme_path_links {
         my ($req, $rel, $readme) = @_;
         my @path = split(m!/+!, $readme);
         my $tip = $req->{-repo}->tip;
-        my $s = "tree <a\nhref=\"${rel}tree/$tip\">root</a>/";
+        my $s = "tree <a\nhref=\"${rel}src/$tip\">root</a>/";
         my @t;
         $s .= join('/', (map {
                 push @t, $_;
                 my $e = PublicInbox::Hval->utf8($_, join('/', @t));
                 my $ep = $e->as_path;
                 my $eh = $e->as_html;
-                $e = "<a\nhref=\"${rel}tree/$tip/$ep\">$eh</a>";
+                $e = "<a\nhref=\"${rel}src/$tip/$ep\">$eh</a>";
                 # bold the last one
                 scalar(@t) == scalar(@path) ? "<b>$e</b>" : $e;
         } @path));
diff --git a/lib/PublicInbox/Repobrowse.pm b/lib/PublicInbox/Repobrowse.pm
index aad0e8ba..5ef9e59a 100644
--- a/lib/PublicInbox/Repobrowse.pm
+++ b/lib/PublicInbox/Repobrowse.pm
@@ -22,7 +22,7 @@ use strict;
 use warnings;
 use PublicInbox::RepoConfig;
 
-my %CMD = map { lc($_) => $_ } qw(Log Commit Tree Patch Blob Raw Tag Atom
+my %CMD = map { lc($_) => $_ } qw(Log Commit Src Patch Blob Raw Tag Atom
         Diff Snapshot);
 my %VCS = (git => 'Git');
 my %LOADED;
@@ -93,7 +93,7 @@ sub call {
         }
 
         # URL syntax: / repo [ / cmd [ / head [ / path ] ] ]
-        # cmd: log | commit | diff | tree | view | blob | snapshot
+        # cmd: log | commit | diff | src | view | blob | snapshot
         # repo and path (@extra) may both contain '/'
         my $path_info = $env->{PATH_INFO};
         my (undef, $repo_path, @extra) = split(m{/+}, $path_info, -1);