1 package Gitalist::URIStructure::Ref;
2 use MooseX::MethodAttributes::Role;
4 use namespace::autoclean;
9 Gitalist::URIStructure::WithLog
14 confess("No repository in the stash")
15 unless $c->stash->{Repository};
18 sub find : Chained('base') PathPart('') CaptureArgs(1) {
19 my ($self, $c, $sha1part) = @_;
20 # FIXME - Should not be here!
21 $c->stash->{Commit} = $c->stash->{Repository}->get_object_or_head($sha1part)
22 or $c->detach('/error404', "Couldn't find a object for '$sha1part' in XXXX!");
25 sub diff : Chained('find') CaptureArgs(0) {}
27 sub diff_fancy : Chained('diff') PathPart('') Args(0) {}
29 sub diff_plain : Chained('diff') PathPart('plain') Args(0) {}
31 sub commit : Chained('find') PathPart('commit') Args(0) {}
33 sub tree : Chained('find') Does('FilenameArgs') Args() {}
35 sub find_blob : Action {
38 my $h = $c->stash->{Repository}->hash_by_path($c->stash->{Commit}->sha1, $c->stash->{filename})
39 || die "No file or sha1 provided.";
40 $c->stash(blob => $c->stash->{Repository}->get_object($h)->content);
43 sub blob : Chained('find') Does('FilenameArgs') Args() {
45 $c->forward('find_blob');
48 sub blame : Chained('find') Does('FilenameArgs') Args() {}
50 sub history : Chained('find') Does('FilenameArgs') Args() {}