Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: feratilbeau [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.007
Fixed in: (no value)



Subject: Running it on Win32
Hello, The backquotes assume that grep, head, tail are available on the OS in addition to the git command. Not always the case on Windows. In addition, on Windows, command-line parameters should surrounded by double quotes. Practical exemple: my $commit = `git show v0.08 --pretty='tformat:(((((%ct)))))' | grep '(((((' | head -1`; die $commit unless $commit =~ /\(\(\(\(\((\d+?)\)\)\)\)\)/; will die. But: my $commit = `git show v0.08 --pretty='tformat:(((((%ct)))))' | grep "(((((" | head -1`; die $commit unless $commit =~ /\(\(\(\(\((\d+?)\)\)\)\)\)/; will run ok. Please find attached a version that: - adds a dependency to the (very portable) IPC::Cmd module - runs fine on Win32 + Note this has been untested on any other platform - Tested only with git distributed with GitHub + i.e. the "Portable Git" version that GitHub is using Regards, Jean-Damien.
Subject: Dist-Zilla-Plugin-ChangelogFromGit-0.007.diff
diff -Naur Dist-Zilla-Plugin-ChangelogFromGit-0.007-old/lib/Dist/Zilla/Plugin/ChangelogFromGit.pm Dist-Zilla-Plugin-ChangelogFromGit-0.007-new/lib/Dist/Zilla/Plugin/ChangelogFromGit.pm --- Dist-Zilla-Plugin-ChangelogFromGit-0.007-old/lib/Dist/Zilla/Plugin/ChangelogFromGit.pm 2013-04-19 05:54:56.000000000 +0200 +++ Dist-Zilla-Plugin-ChangelogFromGit-0.007-new/lib/Dist/Zilla/Plugin/ChangelogFromGit.pm 2013-06-03 13:14:46.737274400 +0200 @@ -20,6 +20,7 @@ use Software::Release; use Software::Release::Change; use Git::Repository::Log::Iterator; +use IPC::Cmd qw/can_run run/; has max_age => ( is => 'ro', @@ -102,7 +103,9 @@ my $earliest_date = $self->earliest_date(); - chomp(my @tags = `git tag`); + can_run('git') or die 'git command not in the path'; + my ($success, $error_message, $full_buf, $stdout_buf, $stderr_buf) = run(command => 'git tag'); + chomp(my @tags = @{$full_buf}); { my $tag_pattern = $self->tag_regexp(); @@ -114,7 +117,14 @@ next; } - my $commit = `git show $tags[$i] --pretty='tformat:(((((%ct)))))' | grep '(((((' | head -1`; + my $gitshow; + run (command => ['git', 'show', $tags[$i]], buffer => \$gitshow); + my $commit; + foreach (split("\n", $gitshow)) { + next if (! /\(\(\(\(\(/); + $commit = $_; + last; + } die $commit unless $commit =~ /\(\(\(\(\((\d+?)\)\)\)\)\)/; $self->push_release( @@ -131,8 +141,12 @@ # releases, up to "HEAD". { - chomp( my $head_version = `git rev-list HEAD | tail -1` ); - chomp( my $head_time = `git show --format=%ct -n1 HEAD | head -1` ); + my $githead; + run (command => 'git rev-list HEAD', buffer => \$githead); + my $head_version = (split("\n", $githead))[-1]; + my $gitshow; + run (command => 'git git show --format=%ct -n1 HEAD', buffer => \$gitshow); + my $head_time = (split("\n", $gitshow))[-1]; if ( not $self->all_releases or $head_version ne $self->get_release(-1)->version()) { $self->push_release(
From: feratilbeau [...] hotmail.com
Please forgive this path - I will do a git pull request. Le Lun 03 Juin 2013 07:17:55, jddfr74 a écrit : Show quoted text
> Hello, > > The backquotes assume that grep, head, tail are available on the OS in > addition to the git command. Not always the case on Windows. In > addition, on Windows, command-line parameters should surrounded by > double quotes. Practical exemple: > > my $commit = `git show v0.08 --pretty='tformat:(((((%ct)))))' | grep > '(((((' | head -1`; > die $commit unless $commit =~ /\(\(\(\(\((\d+?)\)\)\)\)\)/; > > will die. But: > > my $commit = `git show v0.08 --pretty='tformat:(((((%ct)))))' | grep > "(((((" | head -1`; > die $commit unless $commit =~ /\(\(\(\(\((\d+?)\)\)\)\)\)/; > > will run ok. > > Please find attached a version that: > - adds a dependency to the (very portable) IPC::Cmd module > - runs fine on Win32 > + Note this has been untested on any other platform > - Tested only with git distributed with GitHub > + i.e. the "Portable Git" version that GitHub is using > > Regards, Jean-Damien.
I believe I resolved this ticket through the github push. Thanks again!