1 package Gitalist::Controller::Ref;
4 use namespace::autoclean;
6 BEGIN { extends 'Gitalist::Controller' }
7 with 'Gitalist::URIStructure::Ref';
9 sub base : Chained('/repository/find') PathPart('') CaptureArgs(0) {}
14 $c->stash->{diff_tree} = ($c->stash->{Repository}->diff(
15 commit => $c->stash->{Commit},
19 sub raw : Chained('find') Does('FilenameArgs') Args() {
21 $c->forward('find_blob');
23 $c->response->content_type('text/plain; charset=utf-8');
24 $c->response->body(delete $c->stash->{blob});
29 Provides a snapshot of a given commit.
33 sub snapshot : Chained('find') PathPart('snapshot') Args() {
34 my ($self, $c, $format) = @_;
36 my @snap = $c->stash->{Repository}->snapshot(
37 sha1 => $c->stash->{Commit}->sha1,
40 $c->response->status(200);
41 $c->response->headers->header( 'Content-Disposition' =>
42 "attachment; filename=$snap[0]");
43 $c->response->body($snap[1]);
48 A raw patch for a given commit.
52 sub patch : Chained('find') Args(0) {
54 $c->detach('patches', [1]);
59 The patcheset for a given commit ???
63 sub patches : Chained('find') Args(1) {
64 my ($self, $c, $count) = @_;
65 $count ||= Gitalist->config->{patches}{max};
66 my $commit = $c->stash->{Commit};
67 my $parent = $c->req->param('hp') || undef; # FIXME
68 my $patch = $commit->get_patch( $parent, $count );
69 $c->response->body($patch);
70 $c->response->content_type('text/plain');
71 $c->response->status(200);
74 __PACKAGE__->meta->make_immutable;