]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WwwCoderepo.pm
www_coderepo: /tree/ redirects to /$OID/s/
[public-inbox.git] / lib / PublicInbox / WwwCoderepo.pm
index e89a64565da7436a23f975259847b2b790271d7b..668b639881a06a9be1a9fcb253e0dc1a03944496 100644 (file)
@@ -18,6 +18,7 @@ use PublicInbox::Hval qw(ascii_html);
 use PublicInbox::ViewDiff qw(uri_escape_path);
 use PublicInbox::RepoSnapshot;
 use PublicInbox::RepoAtom;
+use PublicInbox::RepoTree;
 
 my $EACH_REF = "git for-each-ref --sort=-creatordate --format='%(HEAD)%00".
        join('%00', map { "%($_)" }
@@ -79,14 +80,7 @@ sub summary_finish {
                $tip_html .= ' '.ascii_html($tip).' --';
        }
        print $zfh <<EOM;
-<pre>
-<a
-href='#readme'>about</a> <a
-href='#heads'>heads</a> <a
-href='#tags'>tags</a>
-
-<a
-id=log>\$</a> git log --pretty=format:'%h %s (%cs)%d'$tip_html
+<pre><a id=log>\$</a> git log --pretty=format:'%h %s (%cs)%d'$tip_html
 EOM
        for (@r) {
                my $d; # decorations
@@ -233,6 +227,11 @@ sub srv { # endpoint called by PublicInbox::WWW
                        ($ctx->{git} = $cr->{$1}) and
                return PublicInbox::ViewVCS::show($ctx, $2);
 
+       if ($path_info =~ m!\A/(.+?)/tree/(.*)\z! and
+                       ($ctx->{git} = $cr->{$1})) {
+               return PublicInbox::RepoTree::srv_tree($ctx, $2) // r(404);
+       }
+
        # snapshots:
        if ($path_info =~ m!\A/(.+?)/snapshot/([^/]+)\z! and
                        ($ctx->{git} = $cr->{$1})) {