Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: SHANTANU [...] cpan.org
Cc:
AdminCc:

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



Subject: Test t/2-commit-dirtydir.t fails due to the string compare with git log output
Hi Avar! The git log message comparison fails because of minor differences in the git log output with what is expected(additional white spaces). Maybe it is just wrong to compare the git log output with a fixed string. a regex match will obviously be more appropriate. This is the line in the test that fails : is( $log->message, "v1.23\n\n- foo\n- bar\n- baz\n", 'commit message taken from changelog' ); Reason is that on my git 1.7.4.1 the output has additional spaces in its log output i.e. 'v1.23 - foo - bar - baz' This is obviously not a serious bug as we can force the install. But then we won't know what else might fail after this test. Replacing the earlier mentioned line with the following should cover the test cases including my own. like( $log->message, qr/v1.23\n[^a-z]*foo[^a-z]*bar[^a-z]*baz/, 'commit message taken from changelog' ); I have attached the fixed test file for you. HTH, -Shantanu Bhadoria
Subject: 2-commit-dirtydir.t
#!perl # # This file is part of Dist-Zilla-Plugin-Git # # This software is copyright (c) 2009 by Jerome Quelin. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use Dist::Zilla 1.093250; use Dist::Zilla::Tester; use Git::Wrapper; use Path::Class; use File::Temp qw/tempdir/; use lib 't/lib'; use Test::More tests => 3; # Mock HOME to avoid ~/.gitexcludes from causing problems $ENV{HOME} = tempdir( CLEANUP => 1 ); # build fake repository my $zilla = Dist::Zilla::Tester->from_config({ dist_root => dir(qw(t commit-dirtydir)), }); chdir $zilla->tempdir->subdir('source'); system "git init"; my $git = Git::Wrapper->new('.'); $git->config( 'user.name' => 'dzp-git test' ); $git->config( 'user.email' => 'dzp-git@test' ); $git->add( qw{ dist.ini Changes } ); $git->commit( { message => 'initial commit' } ); # do a release, with changes and dist.ini updated append_to_file('Changes', "\n"); append_to_file('dist.ini', "\n"); $zilla->release; # check if dist.ini and changelog have been committed my ($log) = $git->log( 'HEAD' ); like( $log->message, qr/v1.23\n[^a-z]*foo[^a-z]*bar[^a-z]*baz/, 'commit message taken from changelog' ); # check if we committed our tarball my @files = $git->ls_files( { cached => 1 } ); ok( ( grep { $_ =~ /releases/ } @files ), "We committed the tarball" ); # We should have no dirty files uncommitted # ignore the "DZP-git.9y5u" temp file, ha! @files = $git->ls_files( { others => 1, modified => 1, unmerged => 1 } ); ok( @files == 1, "No untracked files left" ); sub append_to_file { my ($file, @lines) = @_; open my $fh, '>>', $file or die "can't open $file: $!"; print $fh @lines; close $fh; }
Oops I found more of the same issue in t/2-commit-ws.t t/2-commit.t t/4-push-multi.t t/4-push.t I am attaching the fixed files for all of these tests.
Subject: 4-push-multi.t
#!perl # # This file is part of Dist-Zilla-Plugin-Git # # This software is copyright (c) 2009 by Jerome Quelin. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use Dist::Zilla 1.093250; use Dist::Zilla::Tester; use Cwd qw{ getcwd }; use File::Temp qw{ tempdir }; use Git::Wrapper; use Path::Class; use Test::More; use version; # build fake repository my $zilla = Dist::Zilla::Tester->from_config({ dist_root => dir(qw(t push-multi)), }); chdir $zilla->tempdir->subdir('source'); system "git init"; my $git = Git::Wrapper->new('.'); # rt#56485 - skip test to avoid failures for old git versions my ($version) = $git->version =~ m[^( \d+ \. \d+ \. \d+ )]x; my $gitversion = version->parse( $version ); if ( $gitversion < version->parse('1.7.0') ) { plan skip_all => 'git 1.7.0 or later required for this test'; } else { plan tests => 6; } $git->config( 'user.name' => 'dzp-git test' ); $git->config( 'user.email' => 'dzp-git@test' ); $git->add( qw{ dist.ini Changes } ); $git->commit( { message => 'initial commit' } ); # create a clone, and use it to set up origin my $clone1 = tempdir( CLEANUP => 1 ); my $clone2 = tempdir( CLEANUP => 1 ); my $curr = getcwd; $git->clone( { quiet=>1, 'no-checkout'=>1, bare=>1 }, $curr, $clone1 ); $git->clone( { quiet=>1, 'no-checkout'=>1, bare=>1 }, $curr, $clone2 ); $git->remote('add', 'origin', $clone1); $git->remote('add', 'another', $clone2); $git->config('branch.master.remote', 'origin'); $git->config('branch.master.merge', 'refs/heads/master'); # do the release append_to_file('Changes', "\n"); append_to_file('dist.ini', "\n"); $zilla->release; for my $c ( $clone1, $clone2 ) { # check if everything was pushed $git = Git::Wrapper->new( $c ); my ($log) = $git->log( 'HEAD' ); like( $log->message, qr/v1.23\n[^a-z]*foo[^a-z]*bar[^a-z]*baz/, "commit pushed to $c" ); # check if tag has been correctly created my @tags = $git->tag; is( scalar(@tags), 1, 'one tag pushed' ); is( $tags[0], 'v1.23', 'new tag created after new version' ); } sub append_to_file { my ($file, @lines) = @_; open my $fh, '>>', $file or die "can't open $file: $!"; print $fh @lines; close $fh; }
Subject: 2-commit.t
#!perl # # This file is part of Dist-Zilla-Plugin-Git # # This software is copyright (c) 2009 by Jerome Quelin. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use Dist::Zilla 1.093250; use Dist::Zilla::Tester; use Git::Wrapper; use Path::Class; use Test::More tests => 1; # build fake repository my $zilla = Dist::Zilla::Tester->from_config({ dist_root => dir(qw(t commit)), }); chdir $zilla->tempdir->subdir('source'); system "git init"; my $git = Git::Wrapper->new('.'); $git->config( 'user.name' => 'dzp-git test' ); $git->config( 'user.email' => 'dzp-git@test' ); $git->add( qw{ dist.ini Changes } ); $git->commit( { message => 'initial commit' } ); # do a release, with changes and dist.ini updated append_to_file('Changes', "\n"); append_to_file('dist.ini', "\n"); $zilla->release; # check if dist.ini and changelog have been committed my ($log) = $git->log( 'HEAD' ); like( $log->message, qr/v1.23\n[^a-z]*foo[^a-z]*bar[^a-z]*baz/, 'commit message taken from changelog' ); sub append_to_file { my ($file, @lines) = @_; open my $fh, '>>', $file or die "can't open $file: $!"; print $fh @lines; close $fh; }
Subject: 4-push.t
#!perl # # This file is part of Dist-Zilla-Plugin-Git # # This software is copyright (c) 2009 by Jerome Quelin. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use Dist::Zilla 1.093250; use Dist::Zilla::Tester; use Cwd qw{ getcwd }; use File::Temp qw{ tempdir }; use Git::Wrapper; use Path::Class; use Test::More; use version; # build fake repository my $zilla = Dist::Zilla::Tester->from_config({ dist_root => dir(qw(t push)), }); chdir $zilla->tempdir->subdir('source'); system "git init"; my $git = Git::Wrapper->new('.'); # rt#56485 - skip test to avoid failures for old git versions my ($version) = $git->version =~ m[^( \d+ \. \d+ \. \d+ )]x; my $gitversion = version->parse( $version ); if ( $gitversion < version->parse('1.7.0') ) { plan skip_all => 'git 1.7.0 or later required for this test'; } else { plan tests => 3; } $git->config( 'user.name' => 'dzp-git test' ); $git->config( 'user.email' => 'dzp-git@test' ); $git->add( qw{ dist.ini Changes } ); $git->commit( { message => 'initial commit' } ); # create a clone, and use it to set up origin my $clone = tempdir( CLEANUP => 1 ); my $curr = getcwd; $git->clone( { quiet=>1, 'no-checkout'=>1, bare=>1 }, $curr, $clone ); $git->remote('add', 'origin', $clone); $git->config('branch.master.remote', 'origin'); $git->config('branch.master.merge', 'refs/heads/master'); # do the release append_to_file('Changes', "\n"); append_to_file('dist.ini', "\n"); $zilla->release; # check if everything was pushed $git = Git::Wrapper->new( $clone ); my ($log) = $git->log( 'HEAD' ); like( $log->message, qr/v1.23\n[^a-z]*foo[^a-z]*bar[^a-z]*baz/, 'commit pushed' ); # check if tag has been correctly created my @tags = $git->tag; is( scalar(@tags), 1, 'one tag pushed' ); is( $tags[0], 'v1.23', 'new tag created after new version' ); sub append_to_file { my ($file, @lines) = @_; open my $fh, '>>', $file or die "can't open $file: $!"; print $fh @lines; close $fh; }
Subject: 2-commit-ws.t
#!perl # # This file is part of Dist-Zilla-Plugin-Git # # This software is copyright (c) 2009 by Jerome Quelin. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use Dist::Zilla 1.093250; use Dist::Zilla::Tester; use Git::Wrapper; use Path::Class; use Test::More tests => 1; my $zilla = Dist::Zilla::Tester->from_config({ dist_root => dir(qw(t commit-ws)), }); # build fake repository chdir $zilla->tempdir->subdir('source'); system "git init"; my $git = Git::Wrapper->new('.'); $git->config( 'user.name' => 'dzp-git test' ); $git->config( 'user.email' => 'dzp-git@test' ); $git->add( qw{ dist.ini Changes } ); $git->commit( { message => 'initial commit' } ); # do a release, with changes and dist.ini updated append_to_file('Changes', "\n"); append_to_file('dist.ini', "\n"); $zilla->release; # check if dist.ini and changelog have been committed my ($log) = $git->log( 'HEAD' ); like( $log->message, qr/v1.23\n[^a-z]*foo[^a-z]*bar[^a-z]*baz/, 'commit message taken from changelog' ); sub append_to_file { my ($file, @lines) = @_; open my $fh, '>>', $file or die "can't open $file: $!"; print $fh @lines; close $fh; }
thanks, fixed in v1.112060 (note: duplicate of rt#69701)