Git-Wrapper icon indicating copy to clipboard operation
Git-Wrapper copied to clipboard

Checking out a tag doesn't work with Strawberry in a Github Workflow

Open skirmess opened this issue 3 years ago • 3 comments

Checking out a tag with Git::Wrapper in a Github workflow with Strawberry Perl under Windows hangs forever. The same code works without an issue under Linux.

I've created a small repository with a Github workflow to demonstrate the problem: https://github.com/skirmess/git-wrapper-bug-report

The test.sh script creates a test repository, creates a tag, then clones the repository and checks out the tag.

If you check the output of the Github workflow you'll see that 3 of 4 jobs worked, only the run that checks out the tag with Git::Wrapper on Strawberry didn't work: https://github.com/skirmess/git-wrapper-bug-report/runs/3150607505?check_suite_focus=true

#!/usr/bin/perl

use 5.006;
use strict;
use warnings;

use Git::Wrapper;
use Path::Tiny;

print STDERR " ==> Create Git Test Repository\n";

my $repo_path = path('my_repo.git')->absolute;

mkdir $repo_path or die "Cannot create $repo_path";

{
    my $git = Git::Wrapper->new( $repo_path->stringify );
    $git->init;
    $git->config( 'user.email', '[email protected]' );
    $git->config( 'user.name',  'Test' );

    my $file_A = $repo_path->child('A');
    my $file_B = $repo_path->child('B');
    $file_A->spew('5');
    $git->add('A');
    $git->commit( { message => 'initial commit' } );

    $file_A->spew('7');
    $git->add('A');
    $git->commit( { message => 'second commit' } );

    $git->branch('dev');
    $git->checkout('dev');

    $file_A->spew('11');
    $git->add('A');
    $file_B->spew('13');
    $git->add('B');
    $git->commit( { message => 'commit on dev branch' } );

    $git->checkout('master');

    $git->tag('my-tag');
}

print STDERR " ==> Clone\n";

my $ws = path('workspace');
$ws->mkpath;

print STDERR '  => Line: ', __LINE__, " \$git = Git::Wrapper->new\n";
my $git = Git::Wrapper->new( $ws->stringify );

print STDERR '  => Line: ', __LINE__, " \$git->clone\n";
$git->clone( $repo_path->stringify(), $ws->stringify );

exit 0 if @ARGV && $ARGV[0] eq '--setup-only';

print STDERR " ==> Checkout Tag\n";
print STDERR '  => Line: ', __LINE__, " \$git->checkout\n";
$git->checkout('my-tag');

print STDERR '  => Line: ', __LINE__, " checkout done\n";

# vim: ts=4 sts=4 sw=4 et: syntax=perl

skirmess avatar Jul 24 '21 13:07 skirmess

I've added two new jobs that run on Strawberry and Ubuntu against the port-to-capture-tiny-52 branch, which fixes the problem.

https://github.com/skirmess/git-wrapper-bug-report/runs/3150854143?check_suite_focus=true

skirmess avatar Jul 24 '21 14:07 skirmess

I've added two new jobs that run on Strawberry and Ubuntu against Git::Wrapper 0.048_090, which also fixes the problem.

https://github.com/skirmess/git-wrapper-bug-report/runs/3160421199?check_suite_focus=true

skirmess avatar Jul 26 '21 10:07 skirmess

I'll look more closely at this this weekend; thanks for the report.

genehack avatar Jul 27 '21 03:07 genehack