1 package Gitalist::URIStructure::Repository;
2 use MooseX::MethodAttributes::Role;
3 use Try::Tiny qw/try catch/;
4 use namespace::autoclean;
9 Gitalist::URIStructure::WithLog
12 sub find : Chained('base') PathPart('') CaptureArgs(1) {
13 my ($self, $c, $repos_name) = @_;
14 # XXX FIXME - This should be in the repository fragment controller, and the repository
15 # controller should just check has_repository
17 my $repos = $c->model()->get_repository($repos_name);
20 HEAD => $repos->head_hash,
25 $c->detach('/error_404');
31 $c->stash->{Commit} = $c->stash->{Repository}->get_object($c->stash->{Repository}->head_hash);
34 sub object : Chained('find') PathPart('') Args(1) {
35 my ($self, $c, $sha1) = @_;
37 my $repo = $c->stash->{Repository};
38 my $obj = $c->stash->{Commit} = $repo->get_object($sha1);
39 my($act) = (ref($obj) || '') =~ /::(\w+)$/;
41 $c->res->redirect($c->uri_for_action("/ref/\L$act", [$repo->name, $obj->sha1]));
46 sub summary : Chained('find') PathPart('') Args() {}
48 sub heads : Chained('find') Args() {}
50 sub tags : Chained('find') Args() {}