The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Git::Wrapper::Plus::Refs - Work with refs

VERSION

version 0.004011

SYNOPSIS

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.

METHODS

refs

Lists all refs in the 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.

    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 ☺.

ATTRIBUTES

git

REQUIRED: A Git::Wrapper compatible object

AUTHOR

Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

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.