Git::Wrapper::Plus::Tags - Extract all tags from a repository
version 0.004010
This tool basically gives a more useful interface around
git tag
Namely, each tag returned is a tag object, and you can view tag properties with it.
use Git::Wrapper::Plus::Tags; my $tags_finder = Git::Wrapper::Plus::Tags->new( git => $wrapper ); # All tags for my $tag ( $tags_finder->tags ) { printf "%s - %s\n", $tag->name, $tag->sha1; } # Tag 1.1 for my $tag ( $tags_finder->get_tag('1.1') ) { ... } # All tags starting with 1.1 for my $tag ( $tags_finder->get_tag('1.*') ) { ... } # All tags that point directly to the SHA1 for current master for my $tag ( $tags_finder->tags_for_rev('master') ) { ... }
tags
A List of ::Ref::Tag objects
List
::Ref::Tag
for my $tag ( $tag_finder->tags() ) { }
get_tag
for my $tag ( $tags->get_tag('1.000') ) { } for my $tag ( $tags->get_tag('1.*') ) { }
Note: This can easily return multiple values.
For instance, tags is implemented as
my ( @tags ) = $branches->get_tag('**');
Mostly, because the underlying mechanism is implemented in terms of fnmatch(3)
fnmatch(3)
If the tag does not exist, or no tag match the expression, get_tag will return an empty list.
So in the top example, match is undef if 1.000 does not exist.
match
undef
1.000
tag_sha1_map
A HashRef of sha1 => [ tag, tag ] entries.
HashRef
sha1 => [ tag, tag ]
my $hash = $tag_finder->tag_sha1_map(); for my $sha ( keys %{$hash} ) { my (@tags) = @{ $hash->{ $sha } }; ... }
tags_for_rev
A List of ::Ref::Tag objects that point to the given SHA1.
SHA1
for my $tag ( $tag_finder->tags_for_rev( $sha1_or_commitish_etc ) ) { ... }
git
REQUIRED: A Git::Wrapper compatible object.
refs
OPTIONAL: Git::Wrapper::Plus::Refs instance, auto-built if not specified.
Kent Fredric <kentfredric@gmail.com>
This software is copyright (c) 2014 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.