Dist::Zilla::Util::Git::Refs - Work with refs
version 0.002000
After doing lots of work with Git::Wrapper, I found there's quite a few ways to work with refs, and those ways aren't exactly all equal, or supported on all versions of git.
This abstracts it so things can just use them.
my $refs = Dist::Zilla::Util::Git::Refs->new( zilla => $self->zilla ); $refs->refs(); # A ::Ref object for each entry from `git ls-remote .` my ( @results ) = $refs->get_ref('refs/**'); # the same thing my ( @results ) = $refs->get_ref('refs/heads/**'); # all branches my ( @results ) = $refs->get_ref('refs/tags/**'); # all tags my ( @results ) = $refs->get_ref('refs/remotes/**'); # all remote branches
Note: You probably shouldn't use this module directly, and should instead use one of the ::Util::Git family.
::Util::Git
refs
Lists all refs in the refs/ namespace.
refs/
namespace
my (@refs) = $reffer->refs();
Shorthand for
my (@refs) = $reffer->get_ref('refs/**');
get_ref
Fetch a given ref, or collection of refs, matching a specification.
ref
my ($ref) = $reffer->get_ref('refs/heads/master'); my (@branches) = $reffer->get_ref('refs/heads/**'); my (@tags) = $reffer->get_ref('refs/tags/**');
Though reminder, if you're working with branches or tags, use the relevant modules =).
Kent Fredric <kentfredric@gmail.com>
This software is copyright (c) 2013 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Dist::Zilla::Util::Git::Refs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dist::Zilla::Util::Git::Refs
CPAN shell
perl -MCPAN -e shell install Dist::Zilla::Util::Git::Refs
For more information on module installation, please visit the detailed CPAN module installation guide.