lazy_build => 1,
handles => [ 'parents',
'parent_sha1',
- 'comment',
'author',
'authored_time',
'committer',
'committed_time',
- 'tree_sha1',
],
);
+ # This feels wrong, but current templates assume
+ # these attributes are present on every object.
+ foreach my $key (qw/tree_sha1 comment/) {
+ has $key => ( isa => Str,
+ required => 1,
+ is => 'ro',
+ lazy_build => 1,
+ );
+ method "_build_$key" {
+ return '' 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,
is($obj2->modestr, '?---------', "modestr is correct" );
is($obj2->contents, "bar\n", 'obj2 contents is correct');
is($obj2->size, 4, "size is correct");
+is($obj2->tree_sha1, '', 'tree_sha1 is an empty string');
+is($obj2->comments, '', 'comments is an empty string');