Move search and reflog and patch actions to the right places
[catagits/Gitalist.git] / lib / Gitalist / Controller / Commit.pm
index 2d3151c..a2a3b49 100644 (file)
@@ -34,4 +34,32 @@ sub snapshot : Chained('base') Args() {
     $c->response->body($snap[1]);
 }
 
+=head2 patch
+
+A raw patch for a given commit.
+
+=cut
+
+sub patch : Chained('find') Args(0) {
+    my ($self, $c) = @_;
+    $c->detach('patches', [1]);
+}
+
+=head2 patches
+
+The patcheset for a given commit ???
+
+=cut
+
+sub patches : Chained('find') Args(1) {
+    my ($self, $c, $count) = @_;
+    $count ||= Gitalist->config->{patches}{max};
+    my $commit = $c->stash->{Commit};
+    my $parent = $c->req->param('hp') || undef; # FIXME
+    my $patch = $commit->get_patch( $parent, $count );
+    $c->response->body($patch);
+    $c->response->content_type('text/plain');
+    $c->response->status(200);
+}
+
 __PACKAGE__->meta->make_immutable;