Skip to content

Commit

Permalink
Improve documentation on Object::Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kentfredric committed Aug 23, 2014
1 parent 3c94808 commit 695f1ba
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Revision history for Perl module Git::PurePerl:

- Add basic documentation for Object::Commit (Kent Fredric)
- Add has_ancestor_sha1 method to Object::Commit (Kent Fredric)
- Add Git::PurePerl::Util with handy current_git_dir() util (Kent Fredric)

Expand Down
27 changes: 26 additions & 1 deletion lib/Git/PurePerl/Object/Commit.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ sub BUILD {
$self->comment( decode($encoding, join "\n", @lines) );
}

=head1 METHODS
=head2 tree
Returns the L<< C<::Tree>|Git::PurePerl::Object::Tree >> associated with this commit.
=cut

sub tree {
my $self = shift;
Expand All @@ -76,15 +83,33 @@ sub _push_parent_sha1 {
push(@{$self->parent_sha1s}, $sha1);
}

=head2 parent_sha1
Returns the C<sha1> for the first parent of this this commit.
=cut

sub parent_sha1 {
return shift->parent_sha1s->[0];
}


=head2 parent
Returns the L<< C<::Commit>|Git::PurePerl::Object::Commit >> for this commits first parent.
=cut

sub parent {
my $self = shift;
return $self->git->get_object( $self->parent_sha1 );
}

=head2 parents
Returns L<< C<::Commit>s|Git::PurePerl::Object::Commit >> for all this commits parents.
=cut

sub parents {
my $self = shift;

Expand Down

0 comments on commit 695f1ba

Please sign in to comment.