Git::Wrapper::Plus::Refs - Work with refs
version 0.004011
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 = Git::Wrapper::Plus::Refs->new( git => $git_wrapper ); $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.
refs
Lists all refs in the refs/ namespace.
refs/
namespace
for my $ref ( $reffer->refs() ) { $ref # A Git::Wrapper::Plus::Ref }
Shorthand for
for my $ref ( $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 ☺.
git
REQUIRED: A Git::Wrapper compatible object
Kent Fredric <kentnl@cpan.org>
This software is copyright (c) 2017 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 Git::Wrapper::Plus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Wrapper::Plus
CPAN shell
perl -MCPAN -e shell install Git::Wrapper::Plus
For more information on module installation, please visit the detailed CPAN module installation guide.