use PublicInbox::ViewVCS;
use PublicInbox::WwwStatic qw(r);
use PublicInbox::GitHTTPBackend;
-use PublicInbox::Git;
-use PublicInbox::GitAsyncCat;
use PublicInbox::WwwStream;
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 { "%($_)" }
$tip //= 'HEAD';
my @try = ("$tip:README", "$tip:README.md"); # TODO: configurable
$ctx->{-nr_readme_tries} = [ @try ];
- $ctx->{git}->cat_async($_, \&set_readme, $ctx) for @try;
- if ($ctx->{env}->{'pi-httpd.async'}) {
- PublicInbox::GitAsyncCat::watch_cat($ctx->{git});
- } else { # synchronous
- $ctx->{git}->cat_async_wait;
- }
+ PublicInbox::ViewVCS::do_cat_async($ctx, \&set_readme, @try);
sub { # $_[0] => PublicInbox::HTTP::{Identity,Chunked}
$ctx->{env}->{'qspawn.wcb'} = $_[0];
$qsp->psgi_qx($ctx->{env}, undef, \&capture_refs, $ctx);
}
$path_info =~ m!\A/(.+?)/\z! and
($ctx->{git} = $cr->{$1}) and return summary($self, $ctx);
- $path_info =~ m!\A/(.+?)/([a-f0-9]+)/s/\z! and
+ $path_info =~ m!\A/(.+?)/([a-f0-9]+)/s/([^/]+)?\z! and
($ctx->{git} = $cr->{$1}) and
- return PublicInbox::ViewVCS::show($ctx, $2);
+ return PublicInbox::ViewVCS::show($ctx, $2, $3);
+
+ 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