Subject: | Parsing Git versions with version->parse() doesn't work |
Git versions are incompatible with version->parse().
Dist::Zilla::Plugin::Git fails tests on my machine which has a custom
version of Git:
$ perl -Ilib -d t/4-push.t
Loading DB routines from perl5db.pl version 1.33
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
b 33main::(t/4-push.t:24): my $zilla = Dist::Zilla::Tester-
Show quoted text
>from_config({
main::(t/4-push.t:25): dist_root => dir(qw(t push)),
DB<1>
DB<2> c
Initialized empty Git repository in
/home/avar/.cpanm/work/1279459995.17372/Dist-Zilla-Plugin-Git-
1.101801/tmp/wpQZTSTCcX/source/.git/
main::(t/4-push.t:33): my $gitversion = version->parse( $git-
Show quoted text>version );
DB<2> x $git->version
0 '1.7.2.rc3.125.g94e09.dirty'
DB<3> x version->parse( $git->version );
Invalid version format (non-numeric data) at (eval
596)[/home/avar/perl5/perlbrew/perls/perl-
5.12.1/lib/5.12.1/perl5db.pl:638] line 2.
DB<4>
You might be able to get away with this if you do:
my ($version) = $git->version =~ m[^( \d+ \. \d+ \. \d+ )]x;
Or something try to call git and then skip the tests, or skip it if
you can't parse the version. But that won't help if it also needs to
do this at runtime (I haven't checked).