Skip Menu |

This queue is for tickets about the Dist-Zilla-Plugin-Git CPAN distribution.

Report information
The Basics
Id: 68474
Status: resolved
Priority: 0/
Queue: Dist-Zilla-Plugin-Git

People
Owner: Nobody in particular
Requestors: rob [...] hoelz.ro
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.110500
Fixed in: (no value)



Subject: Git::NextVersion assumes all tags are version-related
If you use Git::NextVersion in a repository that has tags, but no tags that specify a version, it complains "Could not determine last version from tags". For example, the distribution I'm currently converting has the following two tags: require-dbi basic-auth These tags don't mark version or anything; they just specify commits of interest (in this case, commits I intend to revert at some point in time). I believe that Git::NextVersion should default to first_version in this case. Thanks, Rob
From: rob [...] hoelz.ro
Follow up: I just attached a patch that includes a test for the behavior, as well as a fix. On Wed May 25 22:53:18 2011, hoelzro wrote: Show quoted text
> If you use Git::NextVersion in a repository that has tags, but no tags > that specify a version, it complains "Could not determine last version > from tags". For example, the distribution I'm currently converting
has Show quoted text
> the following two tags: > > require-dbi > basic-auth > > These tags don't mark version or anything; they just specify commits
of Show quoted text
> interest (in this case, commits I intend to revert at some point in > time). I believe that Git::NextVersion should default to
first_version Show quoted text
> in this case. > > Thanks, > Rob
Subject: dzil-git-fix.patch
diff -Naur Dist-Zilla-Plugin-Git-1.110500/lib/Dist/Zilla/Plugin/Git/NextVersion.pm Dist-Zilla-Plugin-Git-1.110500-rhoelz/lib/Dist/Zilla/Plugin/Git/NextVersion.pm --- Dist-Zilla-Plugin-Git-1.110500/lib/Dist/Zilla/Plugin/Git/NextVersion.pm 2011-02-19 05:43:25.000000000 -0600 +++ Dist-Zilla-Plugin-Git-1.110500-rhoelz/lib/Dist/Zilla/Plugin/Git/NextVersion.pm 2011-05-26 01:11:31.235496560 -0500 @@ -45,12 +45,12 @@ 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; diff -Naur Dist-Zilla-Plugin-Git-1.110500/t/5-version-default.t Dist-Zilla-Plugin-Git-1.110500-rhoelz/t/5-version-default.t --- Dist-Zilla-Plugin-Git-1.110500/t/5-version-default.t 2011-02-19 05:43:25.000000000 -0600 +++ Dist-Zilla-Plugin-Git-1.110500-rhoelz/t/5-version-default.t 2011-05-26 01:12:07.153868236 -0500 @@ -7,7 +7,7 @@ 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( $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" );
thanks, applied in Dist-Zilla-Plugin-Git-1.111460 (note: for extra credit, i invite you to send pullreqs on github, since your name will also appear as committer in git history)