NAME
Git::Database::Role::RefReader - Abstract role for Git backends that read references
VERSION
version 0.007
SYNOPSIS
package MyGitBackend;
use Moo;
use namespace::clean;
with
'Git::Database::Role::Backend',
'Git::Database::Role::RefReader';
# implement the required methods
sub refs { ... }
DESCRIPTION
A backend doing the additional Git::Database::Role::RefReader role is capable of reading references from a Git repository and return information about them.
REQUIRED METHODS
refs
my $refs = $backend->refs;
Return a hash reference mapping all the (fully qualified) refnames in the repository to the corresponding digests (including HEAD
).
METHODS
ref_names
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 /
).
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_digest
$backend->ref_digest('refs/heads/master'); # some SHA-1
$backend->ref_digest('master'); # undef
Return the digest of the given reference, or undef
.
Note that a fully qualified refname is required. This method does not perform any disambiguation.
AUTHOR
Philippe Bruhat (BooK) <book@cpan.org>.
COPYRIGHT
Copyright 2016 Philippe Bruhat (BooK), all rights reserved.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.