X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FGitalist%2FController%2FRoot.pm;h=e1aed62bc2dfae0b1cbcb3f03c2d2d9de59fb3c6;hb=a7cc1ede5f9729465bb53da9c3a8b300a3aa8a0a;hp=ff5efac078c691cd000d7dbf715974b8fc5a7441;hpb=0ee97fecd5bcbf5c315cee1988e3abd66a1b0840;p=catagits%2FGitalist.git diff --git a/lib/Gitalist/Controller/Root.pm b/lib/Gitalist/Controller/Root.pm index ff5efac..e1aed62 100644 --- a/lib/Gitalist/Controller/Root.pm +++ b/lib/Gitalist/Controller/Root.pm @@ -62,16 +62,19 @@ sub _get_commit { my $h = $c->req->param('h'); my $f = $c->req->param('f'); + my $m = $c->model('Git'); # Either use the provided h(ash) parameter, the f(ile) parameter or just use HEAD. - my $hash = ($h =~ /[^a-f0-9]/ ? $c->model('Git')->head_hash($h) : $h) - || ($f && $c->model('Git')->hash_by_path($f)) - || $c->model('Git')->head_hash + my $hash = ($h =~ /[^a-f0-9]/ ? $m->head_hash($h) : $h) + || ($f && $m->hash_by_path($f)) + || $m->head_hash # XXX This could definitely use more context. || Carp::croak("Couldn't find a hash for the commit object!"); - my $commit = $c->model('Git')->get_object($hash) - or Carp::croak("Couldn't find a commit object for '$hash'!"); + + (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'!"); return $commit; }