Skip to content
Browse files

fix rt#68474 - Git::NextVersion assumes all tags are version-related …

…(rob@hoelz.ro)
  • Loading branch information...
1 parent 18a8e0d commit 6cfdc6af4b2f60edcbfaf7ac9bcb6bee6c6a29b2 @jquelin jquelin committed May 26, 2011
Showing with 11 additions and 3 deletions.
  1. +2 −2 lib/Dist/Zilla/Plugin/Git/NextVersion.pm
  2. +9 −1 t/5-version-default.t
View
4 lib/Dist/Zilla/Plugin/Git/NextVersion.pm
@@ -34,12 +34,12 @@ sub provide_version {
my $regexp = $self->version_regexp;
my @tags = $git->tag;
+ @tags = map { /$regexp/ ? $1 : () } @tags;
return $self->first_version unless @tags;
# find highest version from tags
my ($last_ver) = sort { version->parse($b) <=> version->parse($a) }
- grep { eval { version->parse($_) } }
- map { /$regexp/ ? $1 : () } @tags;
+ grep { eval { version->parse($_) } } @tags;
$self->log_fatal("Could not determine last version from tags")
unless defined $last_ver;
View
10 t/5-version-default.t
@@ -7,7 +7,7 @@ use Path::Class;
use File::pushd qw/pushd tempd/;
use File::Copy::Recursive qw/dircopy/;
-use Test::More 0.88 tests => 6;
+use Test::More 0.88 tests => 8;
# we chdir around so make @INC absolute
BEGIN {
@@ -52,6 +52,14 @@ is( $version, "0.001", "default is 0.001" );
is( $zilla->version, "1.23", "initialized with \$ENV{V}" );
}
+# add a tag that doesn't match the regex
+$git->tag("revert-me-later");
+ok( (grep { /revert-me-later/ } $git->tag), "wrote revert-me-later tag" );
+{
+ $zilla = _new_zilla;
+ is( $zilla->version, "0.001", "default is 0.001" );
+}
+
# tag it
$git->tag("v1.2.3");
ok( (grep { /v1\.2\.3/ } $git->tag), "wrote v1.2.3 tag" );

0 comments on commit 6cfdc6a

Please sign in to comment.
Something went wrong with that request. Please try again.