required => 1,
is => 'ro',
lazy_build => 1,
+ handles => [ 'content',
+ ],
);
- # This feels wrong, but current templates assume
- # these attributes are present on every object.
- foreach my $key (qw/content/) {
- has $key => ( isa => Str,
- required => 1,
- is => 'ro',
- lazy_build => 1,
- );
- method "_build_$key" {
- confess("Object can't " . $key) unless $self->_gpp_obj->can($key);
- return $self->_gpp_obj->$key;
- }
- }
-
# objects can't determine their mode or filename
has file => ( isa => NonEmptySimpleStr,
required => 0,
--- /dev/null
+package Gitalist::Git::Object::Blob;
+use MooseX::Declare;
+
+class Gitalist::Git::Object::Blob extends Gitalist::Git::Object {
+
+}
use List::MoreUtils qw/any zip/;
use DateTime;
use Gitalist::Git::Object::Commit;
+ use Gitalist::Git::Object::Blob;
use aliased 'Gitalist::Git::Object';
our $SHA1RE = qr/[0-9a-fA-F]{40}/;
my $type = $self->run_cmd('cat-file', '-t', $sha1);
chomp($type);
my $class = 'Gitalist::Git::Object';
- if ($type eq 'commit') {
+ use Moose::Autobox;
+ if ($type eq ['commit', 'blob']->any) {
$class .= '::' . ucfirst($type);
};
return $class->new(
project => $self,
sha1 => $sha1,
+ type => $type,
);
}