Git::Database::Role::RefReader - Abstract role for Git backends that read references
version 0.012
package MyGitBackend; use Moo; use namespace::clean; with 'Git::Database::Role::Backend', 'Git::Database::Role::RefReader'; # implement the required methods sub refs { ... }
A backend doing the additional Git::Database::Role::RefReader role is capable of reading references from a Git repository and return information about them.
my $refs = $backend->refs;
Return a hash reference mapping all the (fully qualified) refnames in the repository to the corresponding digests (including HEAD).
HEAD
my @refs = $backend->ref_names; my @heads = $backend->ref_names('heads'); my @remotes = $backend->ref_names('remotes');
Return the list of refnames in the repository.
The optional argument is used to limit the list of returned names to those having the part after refs/ in their name equal to it (up to the next /).
refs/
/
For example, given the following refs:
HEAD refs/heads/master refs/remotes/origin/HEAD refs/remotes/origin/master refs/tags/world
ref_names('heads') will return refs/heads/master, ref_names('head') will return nothing, ref_names('remotes/origin') will return refs/remotes/origin/HEAD and refs/remotes/origin/master.
ref_names('heads')
refs/heads/master
ref_names('head')
ref_names('remotes/origin')
refs/remotes/origin/HEAD
refs/remotes/origin/master
$backend->ref_digest('refs/heads/master'); # some SHA-1 $backend->ref_digest('master'); # undef
Return the digest of the given reference, or undef.
undef
Note that a fully qualified refname is required. This method does not perform any disambiguation.
Philippe Bruhat (BooK) <book@cpan.org>.
Copyright 2016 Philippe Bruhat (BooK), all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Git::Database, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Database
CPAN shell
perl -MCPAN -e shell install Git::Database
For more information on module installation, please visit the detailed CPAN module installation guide.