Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository.xs: Added is_head_detached() #83

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/Git/Raw/Repository.pm
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,11 @@ Check if the repository is bare.

Check if the repository is a shallow clone.

=head2 is_head_detached( )

Check if the repository's HEAD is detached, that is, it points directly to
a commit.

=head1 AUTHOR

Alessandro Ghedini <alexbio@cpan.org>
Expand Down
1 change: 1 addition & 0 deletions t/01-repo.t
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ $config -> foreach(sub {
});

is $repo -> state, "none";
is $repo -> is_head_detached, 0;

my $commit_msg_file = File::Spec->catfile($repo -> path, 'MERGE_MSG');

Expand Down
9 changes: 9 additions & 0 deletions xs/Repository.xs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,15 @@ is_shallow(self)

OUTPUT: RETVAL

SV *
is_head_detached(self)
Repository self

CODE:
RETVAL = newSViv(git_repository_head_detached(self));

OUTPUT: RETVAL

void
DESTROY(self)
Repository self
Expand Down