Skip to content

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

Description

@skirmess

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', 'test@example.com' );
    $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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions