$c->stash(
commit => $commit,
info => $c->model('Git')->project_info($c->model('Git')->project),
- log_lines => [$c->model('Git')->list_revs(sha1 => $commit->sha1, count => 16)],
+ log_lines => [$c->model('Git')->list_revs(
+ sha1 => $commit->sha1, count => Gitalist->config->{paging}{summary}
+ )],
refs => $c->model('Git')->references,
heads => [$c->model('Git')->heads],
- HEAD => $c->model('Git')->head_hash,
action => 'summary',
);
}
$c->stash(
commit => $self->_get_commit($c),
heads => [$c->model('Git')->heads],
- HEAD => $c->model('Git')->head_hash,
action => 'heads',
);
}
my $commit = $self->_get_commit($c);
my $filename = $c->req->param('f')
|| croak("No file specified!");
- my @diff = $c->model('Git')->diff(
- $commit->parent_sha1, $commit->sha1, '--', $filename
+ my($tree, $patch) = $c->model('Git')->diff(
+ commit => $commit,
+ parent => $c->req->param('hp') || '',
+ file => $filename,
+ patch => 1,
);
$c->stash(
commit => $commit,
- diff => \@diff,
+ diff => $patch,
# XXX Hack hack hack, see View::SyntaxHighlight
- blobs => [$diff[0]->{diff}],
+ blobs => [$patch->[0]->{diff}],
language => 'Diff',
action => 'blobdiff',
);
my $commit = $self->_get_commit($c);
$c->stash(
commit => $commit,
- diff_tree => [$c->model('Git')->diff_tree($commit)],
+ diff_tree => ($c->model('Git')->diff(commit => $commit))[0],
branches_on => [$c->model('Git')->refs_for($commit->sha1)],
action => 'commit',
);
my ( $self, $c ) = @_;
my $commit = $self->_get_commit($c);
- my @difflist = $c->model('Git')->diff($commit->parent_sha1, $commit->sha1);
+ my($tree, $patch) = $c->model('Git')->diff(
+ commit => $commit,
+ parent => $c->req->param('hp') || '',
+ patch => 1,
+ );
$c->stash(
commit => $commit,
- diff_tree => [$c->model('Git')->diff_tree($commit)],
- diff => \@difflist,
+ diff_tree => $tree,
+ diff => $patch,
# XXX Hack hack hack, see View::SyntaxHighlight
- blobs => [map $_->{diff}, @difflist],
+ blobs => [map $_->{diff}, @$patch],
language => 'Diff',
action => 'commitdiff',
);
sub shortlog : Local {
my ( $self, $c ) = @_;
- my $commit = $self->_get_commit($c);
- # XXX Needs paging.
+ my $commit = $self->_get_commit($c);
+ my %logargs = (
+ sha1 => $commit->sha1,
+ count => Gitalist->config->{paging}{log},
+ ($c->req->param('f') ? (file => $c->req->param('f')) : ())
+ );
+
+ my $page = $c->req->param('pg') || 0;
+ $logargs{skip} = $c->req->param('pg') * $logargs{count}
+ if $c->req->param('pg');
+
$c->stash(
commit => $commit,
- log_lines => [$c->model('Git')->list_revs(sha1 => $commit->sha1)],
+ log_lines => [$c->model('Git')->list_revs(%logargs)],
refs => $c->model('Git')->references,
action => 'shortlog',
+ page => $page + 1,
);
}
);
}
+sub search : Local {
+ Carp::croak "Not implemented.";
+}
+
+sub search_help : Local {
+ Carp::croak "Not implemented.";
+}
+
=head2 auto
Populate the header and footer. Perhaps not the best location.
sub auto : Private {
my($self, $c) = @_;
- # XXX Temp hack until a decent solution is invented.
- $c->model('Git')->project($c->req->param('p'))
- if $c->req->param('p');
-
# Yes, this is hideous.
$self->header($c);
$self->footer($c);
if(defined $project) {
$c->stash(
- search_text => ( $c->req->param('s') || $c->req->param('searchtext') ),
+ search_text => ( $c->req->param('s') || $c->req->param('searchtext') || ''),
search_hash => ( $c->req->param('hb') || $c->req->param('hashbase')
|| $c->req->param('h') || $c->req->param('hash')
|| 'HEAD' ),
=cut
-sub end : ActionClass('RenderView') {}
+sub end : ActionClass('RenderView') {
+ # Give every view the current HEAD.
+ $_[1]->stash->{HEAD} = $_[1]->model('Git')->head_hash;
+}
=head1 AUTHOR