X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FGitalist%2FController%2FFragment%2FRef.pm;h=8f58ce09c3395e6f419bfc2b659e4090c174b0eb;hb=2298d93ff984748b0c15d19bad6fdebb1d81c4f1;hp=97ef77b8796c2add9102d99f1b9b8237dc9fc208;hpb=e404e9a6ba9fc91298334246c503009f408eb737;p=catagits%2FGitalist.git diff --git a/lib/Gitalist/Controller/Fragment/Ref.pm b/lib/Gitalist/Controller/Fragment/Ref.pm index 97ef77b..8f58ce0 100644 --- a/lib/Gitalist/Controller/Fragment/Ref.pm +++ b/lib/Gitalist/Controller/Fragment/Ref.pm @@ -29,7 +29,7 @@ sub _diff { diff => $patch, # XXX Hack hack hack, see View::SyntaxHighlight blobs => [map $_->{diff}, @$patch], - %filename, + %diff_args, ); } @@ -48,13 +48,13 @@ after tree => sub { my ( $self, $c ) = @_; my $repository = $c->stash->{Repository}; my $commit = $c->stash->{Commit}; - my $tree = $c->stash->{filename} - ? $repository->get_object($repository->hash_by_path($commit->sha1, $c->stash->{filename})) - : $repository->get_object($commit->tree_sha1) + my $tree_obj = $c->stash->{filename} + ? $commit->sha_by_path($c->stash->{filename}) + : $commit->tree->[0] ; $c->stash( - tree => $tree, - tree_list => [$repository->list_tree($tree->sha1)], + tree => $tree_obj, + tree_list => $tree_obj->tree, ); }; @@ -62,7 +62,7 @@ after blame => sub { my($self, $c) = @_; my $repository = $c->stash->{Repository}; - # WTF? + my $blame = $c->stash->{Commit}->blame($c->stash->{filename}, $c->stash->{Commit}->sha1); $c->stash( blame => $blame, @@ -72,6 +72,12 @@ after blame => sub { $c->forward('Model::ContentMangler'); }; +=encoding UTF-8 + +=head1 NAME + +Gitalist::Controller::Fragment::Ref - Fragment::Ref module for Gitalist::Controller + =head2 blob The blob action i.e the contents of a file. @@ -94,16 +100,12 @@ after history => sub { my %logargs = ( sha1 => $c->stash->{Commit}->sha1, - count => 25, #Gitalist->config->{paging}{log} || 25, + count => Gitalist->config->{paging}{log} || 25, ($filename ? (file => $filename) : ()) ); - my $file = $repository->get_object( - $repository->hash_by_path( - $repository->head_hash, - $filename - ) - ); + my $commit = $repository->get_object('HEAD'); + my $file = $commit->sha_by_path($filename); my $page = $c->req->param('pg') || 0; $logargs{skip} = $c->req->param('pg') * $logargs{count} @@ -114,6 +116,7 @@ after history => sub { refs => $repository->references, filename => $filename, filetype => $file->type, + page => $page, ); }; @@ -131,10 +134,10 @@ after file_commit_info => sub { my $json_obj = !$commit ? { } : { - sha1 => $commit->sha1, - comment => $c->stash->{short_cmt}->($commit->comment), - age => $c->stash->{time_since}->($commit->authored_time), - }; + sha1 => $commit->sha1, + comment => $c->stash->{short_cmt}->($commit->comment), + age => $c->stash->{time_since}->($commit->authored_time), + }; $c->response->content_type('application/json'); # XXX Make use of the json branch