Erm, this broke all the tests, but I'm not sure why.. It has made the reaching into...
Tomas Doran (t0m) [Sun, 1 Nov 2009 18:27:23 +0000 (18:27 +0000)]
lib/Gitalist/Model/Git.pm

index c9e4a34..e233e7c 100644 (file)
@@ -24,8 +24,10 @@ use Git::PurePerl;
 sub build_per_context_instance {
   my ( $self, $c ) = @_;
 
+  my $app = blessed($c) || $c;
   my $model = Git::Repos->new(
     project => ([$c->req->parameters->{p} || '/']->flatten)[0],
+    repo_dir => $app->config->{repo_dir}, # FIXME - Move to model config
   );
 
   # This is fugly as fuck. Move Git::PurePerl construction into attribute builders..
@@ -55,7 +57,7 @@ use Git::PurePerl;
 our $SHA1RE = qr/[0-9a-fA-F]{40}/;
 
 # These are static and only need to be setup on app start.
-has repo_dir => ( isa => NonEmptySimpleStr, is => 'ro', lazy_build => 1 ); # Fixme - path::class
+has repo_dir => ( isa => NonEmptySimpleStr, is => 'ro' ); # Fixme - path::class
 has git      => ( isa => NonEmptySimpleStr, is => 'ro', lazy_build => 1 );
 # These are dynamic and can be different from one request to the next.
 has project  => ( isa => NonEmptySimpleStr, is => 'rw');
@@ -85,10 +87,6 @@ EOR
 
     return $git;
 }
-sub _build_repo_dir {
-  return Gitalist->config->{repo_dir};
-}
 
 =head2 get_object