Get sane debugging info for the setup of everything
[catagits/Gitalist.git] / lib / Gitalist / Model / CollectionOfRepos.pm
index 6fdcf2c..090cb8c 100644 (file)
@@ -97,15 +97,13 @@ sub _build_repos_dir {
         || $opts->{repos_dir} || $ENV{GITALIST_REPO_DIR} || undef;
 }
 
-sub BUILD {
-    my $self = shift;
-    $self->class();
-    if ($self->repos_dir) { $self->repos_dir->resolve }
-}
-
 sub build_per_context_instance {
     my ($self, $ctx) = @_;
 
+    $self->class();
+
+    if ($self->repos_dir) { $self->repos_dir->resolve }
+
     my %args = (
         export_ok => $self->export_ok || '',
         $self->_has_whitelist ? (whitelist => $self->whitelist) : (),
@@ -117,9 +115,11 @@ sub build_per_context_instance {
 
     my $class = $self->class;
 
-    $ctx->log->debug("Using class '$class'") if $ctx->debug;
+    my $model = $class->new(%args);
+
+    $ctx->log->debug("Using class '$class' " . $model->debug_string) if $ctx->debug;
 
-    return $class->new(%args);
+    return $model;
 }
 
 __PACKAGE__->meta->make_immutable;