91d1405f34a84f9fb2953bef016489870d840f01
[catagits/Gitalist.git] / lib / Gitalist / URIStructure / Commit.pm
1 package Gitalist::URIStructure::Commit;
2 use MooseX::MethodAttributes::Role;
3 use namespace::autoclean;
4
5 requires 'base';
6
7 after 'base' => sub {
8     my ($self, $c) = @_;
9     confess("No repository in the stash")
10         unless $c->stash->{Repository};
11 };
12
13 sub find : Chained('base') PathPart('') CaptureArgs(1) {
14     my ($self, $c, $sha1part) = @_;
15     # FIXME - Should not be here!
16     $c->stash->{Commit} = $c->stash->{Repository}->get_object($sha1part)
17         or $c->detach('/error404', "Couldn't find a object for '$sha1part' in XXXX!");
18 }
19
20 sub diff : Chained('find') Args(0) {}
21
22 sub tree : Chained('find') Args(0) {}
23
24 sub commit : Chained('find') Args(0) {}
25
26 1;