X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FGitalist%2FURIStructure%2FRepository.pm;h=2e142bd8f722df930426ac1af4d627c0ca907e37;hb=d8712c37489298ea0ea0fc02d4edd46ee5aa357d;hp=47e7016f60b47b62869c87cee5afe565bfe690f9;hpb=b9423b8ea62881ee231ac8ba7de9eb7208f894ea;p=catagits%2FGitalist.git diff --git a/lib/Gitalist/URIStructure/Repository.pm b/lib/Gitalist/URIStructure/Repository.pm index 47e7016..2e142bd 100644 --- a/lib/Gitalist/URIStructure/Repository.pm +++ b/lib/Gitalist/URIStructure/Repository.pm @@ -18,6 +18,7 @@ sub find : Chained('base') PathPart('') CaptureArgs(1) { $c->stash( Repository => $repos, HEAD => $repos->head_hash, + data => $repos, ); } catch { @@ -30,10 +31,22 @@ before 'log' => sub { $c->stash->{Commit} = $c->stash->{Repository}->get_object($c->stash->{Repository}->head_hash); }; -sub summary : Chained('find') PathPart('') Args(0) {} +sub object : Chained('find') PathPart('') Args(1) { + my ($self, $c, $sha1) = @_; -sub heads : Chained('find') Args(0) {} + my $repo = $c->stash->{Repository}; + my $obj = $c->stash->{Commit} = $repo->get_object($sha1); + my($act) = (ref($obj) || '') =~ /::(\w+)$/; -sub tags : Chained('find') Args(0) {} + $c->res->redirect($c->uri_for_action("/ref/\L$act", [$repo->name, $obj->sha1])); + $c->res->status(301); + +} + +sub summary : Chained('find') PathPart('') Args() {} + +sub heads : Chained('find') Args() {} + +sub tags : Chained('find') Args() {} 1;