3 class Gitalist::Git::Object {
4 use File::Stat::ModeString qw/mode_to_string/;
5 has project => ( isa => 'Gitalist::Git::Project',
8 handles => [ 'run_cmd' ],
10 has sha1 => ( isa => 'Str',
13 has type => ( isa => 'Str',
17 has file => ( isa => 'Str',
20 has mode => ( isa => 'Int',
23 has modestr => ( isa => 'Str',
27 has size => ( isa => 'Int',
32 my $output = $self->run_cmd(qw/cat-file -t/, $self->{sha1});
37 method _build_modestr {
38 my $modestr = mode_to_string($self->{mode});
43 my $output = $self->run_cmd(qw/cat-file -s/, $self->{sha1});
50 Return the contents of a given file.
55 if ( $self->type ne 'blob' ) {
56 die "object $self->sha1 is not a file\n"
59 my $output = $self->run_cmd(qw/cat-file -p/, $self->sha1);
60 return unless $output;