Skip to content

Commit

Permalink
Odb/Object.xs: added data()
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesg committed Mar 21, 2017
1 parent b84102b commit 45a4b89
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Git/Raw/Odb/Object.pm
Expand Up @@ -34,6 +34,10 @@ Get the object type.
Get the object size.
=head2 data( )
Get the uncompressed, raw data without the leading header.
=head1 LICENSE AND COPYRIGHT
Copyright 2016 Jacques Germishuys.
Expand Down
2 changes: 2 additions & 0 deletions t/02-commit.t
Expand Up @@ -436,6 +436,8 @@ isa_ok $obj, "Git::Raw::Odb::Object";
is $obj -> type, Git::Raw::Object -> COMMIT;
is $obj -> id, $commit4 -> id;
is $obj -> size, 186;
my $data = $obj -> data;
is length($data), 186;

is $commit4 -> message, "fourth commit\n";
is $commit4 -> summary, "fourth commit";
Expand Down
9 changes: 9 additions & 0 deletions xs/Odb/Object.xs
Expand Up @@ -27,6 +27,15 @@ type(self)

OUTPUT: RETVAL

SV *
data(self)
Odb_Object self

CODE:
RETVAL = newSVpv(git_odb_object_data(self), git_odb_object_size(self));

OUTPUT: RETVAL

void
DESTROY(self)
SV *self
Expand Down

0 comments on commit 45a4b89

Please sign in to comment.