my $repository = $c->stash->{Repository};
my $filename = join('/', @fn);
-
# WTF?
my $blame = $c->stash->{Commit}->blame($filename, $c->stash->{Commit}->sha1);
$c->stash(
unless $c->stash->{no_wrapper};
};
+=head2 blob
+
+The blob action i.e the contents of a file.
+
+=cut
+
+after blob => sub {
+ my ( $self, $c, @fn ) = @_;
+
+ my $filename = join('/', @fn);
+ my $repository = $c->stash->{Repository};
+ my $h =
+ $repository->hash_by_path($c->stash->{Commit}->sha1, $filename)
+ || die "No file or sha1 provided.";
+ my $blob = $repository->get_object($h);
+ $c->stash(
+ blob => $blob->content,
+ filename => $filename,
+ # XXX Hack hack hack, see View::SyntaxHighlight
+ language => ($filename =~ /\.p[lm]$/i ? 'Perl' : ''),
+ );
+
+ $c->forward('View::SyntaxHighlight')
+ unless $c->stash->{no_wrapper};
+};
+
__PACKAGE__->meta->make_immutable;
return $blob, $repository->get_object($hb), $filename;
}
-=head2 blob
-The blob action i.e the contents of a file.
-
-=cut
-
-sub blob : Chained('base') Args(0) {
- my ( $self, $c ) = @_;
-
- my($blob, $head, $filename) = $self->_blob_objs($c);
- $c->stash(
- blob => $blob->content,
- head => $head,
- filename => $filename,
- # XXX Hack hack hack, see View::SyntaxHighlight
- language => ($filename =~ /\.p[lm]$/i ? 'Perl' : ''),
- );
-
- $c->forward('View::SyntaxHighlight')
- unless $c->stash->{no_wrapper};
-}
=head2 blob_plain
[% END %]
[% INCLUDE 'nav/path.tt2' %]
<div>
- <pre class='blob'>[% blob %]</pre>
+ <pre class='blob'>[% subinclude('/fragment/commit/blob', c.req.captures, c.req.args.to_path) %]</pre>
</div>
</div>