Merge branch 'model-reorg' into tp-intg
Zachary Stevens [Thu, 12 Nov 2009 21:36:23 +0000 (21:36 +0000)]
Conflicts:
lib/Gitalist/Git/Project.pm

1  2 
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