$action->();
};
$capture->stop();
-
+
use Data::Dumper;
die Dumper($@)
if $@;
-
+
my $output = join '', $capture->read;
$c->stash->{gitweb_output} = $output;
$c->stash->{template} = 'gitweb.tt2';
}
sub _get_commit {
- my($self, $c) = @_;
+ my($self, $c, $haveh) = @_;
- my $h = $c->req->param('h');
+ my $h = $haveh || $c->req->param('h') || '';
my $f = $c->req->param('f');
my $m = $c->model('Git');
# XXX This could definitely use more context.
|| Carp::croak("Couldn't find a hash for the commit object!");
-
+
(my $pd = $m->project_dir( $m->project )) =~ s{/\.git$}();
my $commit = $m->get_object($hash)
or Carp::croak("Couldn't find a commit object for '$hash' in '$pd'!");
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',
);
log_lines => [$c->model('Git')->list_revs(%logargs)],
refs => $c->model('Git')->references,
action => 'shortlog',
- page => $page + 1,
+ page => $page,
);
}
sub tree : Local {
my ( $self, $c ) = @_;
- my $commit = $self->_get_commit($c);
+ my $commit = $self->_get_commit($c, $c->req->param('hb'));
+ my $tree = $c->model('Git')->get_object($c->req->param('h') || $commit->tree_sha1);
$c->stash(
# XXX Useful defaults needed ...
commit => $commit,
- tree => $c->model('Git')->get_object($c->req->param('hb')),
- tree_list => [$c->model('Git')->list_tree($commit->sha1)],
+ tree => $tree,
+ tree_list => [$c->model('Git')->list_tree($tree->sha1)],
+ path => $c->req->param('f') || '',
action => 'tree',
);
}
);
}
+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.
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' ),