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) {}
11 sub raw : Chained('find') Does('FilenameArgs') Args() {
13 $c->forward('find_blob');
15 $c->response->content_type('text/plain; charset=utf-8');
16 $c->response->body(delete $c->stash->{blob});
21 Provides a snapshot of a given commit.
25 sub snapshot : Chained('base') Args() {
26 my ($self, $c, $format) = @_;
28 my @snap = $c->stash->{Repository}->snapshot(
29 sha1 => $c->stash->{Commit}->sha1,
32 $c->response->status(200);
33 $c->response->headers->header( 'Content-Disposition' =>
34 "attachment; filename=$snap[0]");
35 $c->response->body($snap[1]);
40 A raw patch for a given commit.
44 sub patch : Chained('find') Args(0) {
46 $c->detach('patches', [1]);
51 The patcheset for a given commit ???
55 sub patches : Chained('find') Args(1) {
56 my ($self, $c, $count) = @_;
57 $count ||= Gitalist->config->{patches}{max};
58 my $commit = $c->stash->{Commit};
59 my $parent = $c->req->param('hp') || undef; # FIXME
60 my $patch = $commit->get_patch( $parent, $count );
61 $c->response->body($patch);
62 $c->response->content_type('text/plain');
63 $c->response->status(200);
66 __PACKAGE__->meta->make_immutable;