From: Zachary Stevens Date: Thu, 12 Nov 2009 21:36:23 +0000 (+0000) Subject: Merge branch 'model-reorg' into tp-intg X-Git-Tag: 0.000000_01~37 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4b6bcf448f68c01132aea9a7d9181d1e32e4b1fe;p=catagits%2FGitalist.git Merge branch 'model-reorg' into tp-intg Conflicts: lib/Gitalist/Git/Project.pm --- 4b6bcf448f68c01132aea9a7d9181d1e32e4b1fe diff --cc lib/Gitalist/Git/Project.pm index 44b5704,179f043..f2e5b3a --- a/lib/Gitalist/Git/Project.pm +++ b/lib/Gitalist/Git/Project.pm @@@ -28,17 -28,6 +28,20 @@@ class Gitalist::Git::Project with Gital use DateTime; use aliased 'Gitalist::Git::Object'; + our $SHA1RE = qr/[0-9a-fA-F]{40}/; + + around BUILDARGS (ClassName $class: Dir $dir) { ++ # Allows us to be called as Project->new($dir) ++ # Last path component becomes $self->name ++ # Full path to git objects becomes $self->path + my $name = $dir->dir_list(-1); + $dir = $dir->subdir('.git') if (-f $dir->file('.git', 'HEAD')); + confess("Can't find a git repository at " . $dir) + unless ( -f $dir->file('HEAD') ); + return $class->$orig(name => $name, + path => $dir); + } + =head1 ATTRIBUTES =head2 name