Why not adopt me?
NAME
Git::Wrapper::Plus::Tags - Extract all tags from a repository
VERSION
version 0.004011
SYNOPSIS
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.
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'
) ) {
...
}
METHODS
tags
A List
of ::Ref::Tag
objects
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)
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.
tag_sha1_map
A HashRef
of sha1 => [ tag, tag ]
entries.
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
.
for
my
$tag
(
$tag_finder
->tags_for_rev(
$sha1_or_commitish_etc
) ) {
...
}
ATTRIBUTES
git
REQUIRED: A Git::Wrapper compatible object.
refs
OPTIONAL: Git::Wrapper::Plus::Refs instance, auto-built if not specified.
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.