X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FGitalist%2FGit%2FRepo.pm;h=fe18e97003e06a4f339f74aaa785f4b208b0e934;hb=255ee7430462f5b7b1d5630e00d0901f6f649c8e;hp=6470cbfb41418efa8d2e8e78f4cd7095e639aafb;hpb=dd3c4caf431e743a02f5e720fee1c4e7a91dd8db;p=catagits%2FGitalist.git diff --git a/lib/Gitalist/Git/Repo.pm b/lib/Gitalist/Git/Repo.pm index 6470cbf..fe18e97 100644 --- a/lib/Gitalist/Git/Repo.pm +++ b/lib/Gitalist/Git/Repo.pm @@ -16,7 +16,7 @@ C repo. =cut method _is_git_repo ($dir) { - return -f $dir->file('HEAD') || -f $dir->file('.git/HEAD'); + return -f $dir->file('HEAD') || -f $dir->file('.git', 'HEAD'); } =head2 project_dir @@ -26,14 +26,9 @@ The directory under which the given project will reside i.e C<.git/..> =cut method project_dir ($project) { - my $dir = blessed($project) && $project->isa('Path::Class::Dir') - ? $project->stringify - : $self->dir_from_project_name($project); - - $dir .= '/.git' - if -f dir($dir)->file('.git/HEAD'); - - return $dir; + -f $project->file('.git', 'HEAD') + ? $project->subdir('.git') + : $project; } =head2 list_projects @@ -54,12 +49,12 @@ each item will contain the contents of L. next unless -d $obj; next unless $self->_is_git_repo($obj); - # XXX Leaky abstraction alert! - my $is_bare = !-d $obj->subdir('.git'); - - my $name = (File::Spec->splitdir($obj))[-1]; - push @ret, Gitalist::Git::Project->new( name => $name, - path => $obj, + # FIXME - Is resolving project_dir here sane? + # I think not, just pass $obj down, and + # resolve $project->path and $project->is_bare + # in BUILDARGS + push @ret, Gitalist::Git::Project->new( name => $file, + path => $self->project_dir($obj), ); }