my $h = $haveh || $c->req->param('h') || '';
my $f = $c->req->param('f');
- # FIXME this can die when everything is migrated
- my ($m, $pd);
- if (defined $c->stash->{current_model} &&
- $c->stash->{current_model} eq 'GitRepos') {
- $m = $c->stash->{Project};
- $pd = $m->path;
- } else {
- $m = $c->model();
- ($pd = $m->project_dir( $m->project )) =~ s{/\.git$}();
- }
+ my $m = $c->stash->{Project};
+ my $pd = $m->path;
# Either use the provided h(ash) parameter, the f(ile) parameter or just use HEAD.
my $hash = ($h =~ /[^a-f0-9]/ ? $m->head_hash($h) : $h)
sub index :Path :Args(0) {
my ( $self, $c ) = @_;
$c->detach($c->req->param('a')) if $c->req->param('a');
- $c->stash(current_model => 'GitRepos');
my $list = $c->model()->list_projects;
unless(@$list) {
sub summary : Local {
my ( $self, $c ) = @_;
- $c->stash(current_model => 'GitRepos');
my $project = $c->stash->{Project};
my $commit = $self->_get_commit($c);
$c->stash(
sub heads : Local {
my ( $self, $c ) = @_;
- $c->stash( current_model => 'GitRepos' );
my $project = $c->stash->{Project};
$c->stash(
commit => $self->_get_commit($c),
sub blob : Local {
my ( $self, $c ) = @_;
- $c->stash(current_model => 'GitRepos');
my $project = $c->stash->{Project};
my $h = $c->req->param('h')
|| $project->hash_by_path($c->req->param('hb'), $c->req->param('f'))
sub blobdiff : Local {
my ( $self, $c ) = @_;
- $c->stash(current_model => 'GitRepos');
my $commit = $self->_get_commit($c, $c->req->param('hb'));
my $filename = $c->req->param('f')
|| croak("No file specified!");
sub commit : Local {
my ( $self, $c ) = @_;
- $c->stash(current_model => 'GitRepos');
my $project = $c->stash->{Project};
my $commit = $self->_get_commit($c);
$c->stash(
sub commitdiff : Local {
my ( $self, $c ) = @_;
- $c->stash(current_model => 'GitRepos');
my $commit = $self->_get_commit($c);
my($tree, $patch) = $c->stash->{Project}->diff(
commit => $commit,
sub shortlog : Local {
my ( $self, $c ) = @_;
- $c->stash(current_model => 'GitRepos');
my $project = $c->stash->{Project};
my $commit = $self->_get_commit($c);
my %logargs = (
sub tree : Local {
my ( $self, $c ) = @_;
- $c->stash(current_model => 'GitRepos');
my $project = $c->stash->{Project};
my $commit = $self->_get_commit($c, $c->req->param('hb'));
my $tree = $project->get_object($c->req->param('h') || $commit->tree_sha1);
sub reflog : Local {
my ( $self, $c ) = @_;
- $c->stash(current_model => 'GitRepos');
my @log = $c->stash->{Project}->reflog(
'--since=yesterday'
);
}
}
- $c->stash->{version} = $c->config->{version};
+ $c->stash->{version} = $Gitalist::VERSION;
$c->stash->{git_version} = $c->model('GitRepos')->run_cmd('--version');
$c->stash->{title} = $title;
=cut
sub end : ActionClass('RenderView') {
- my ($self, $c) = @_;
- # Give project views the current HEAD.
- if ($c->stash->{project}) {
- if ($c->stash->{current_model} &&
- $c->stash->{current_model} eq 'GitRepos') {
- $c->stash->{HEAD} = $c->stash->{Project}->head_hash;
- } else {
- $c->stash->{HEAD} = $c->model()->head_hash;
- }
- }
+ my ($self, $c) = @_;
+ # Give project views the current HEAD.
+ if ($c->stash->{Project}) {
+ $c->stash->{HEAD} = $c->stash->{Project}->head_hash;
+ }
}
sub error_404 :Private {
$c->stash(
title => 'Page not found',
content => 'Page not found',
- )
+ );
}
sub age_string {