Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to clone submodules recursively #12

Open
zmughal opened this issue Oct 26, 2023 · 1 comment
Open

Add option to clone submodules recursively #12

zmughal opened this issue Oct 26, 2023 · 1 comment

Comments

@zmughal
Copy link
Member

zmughal commented Oct 26, 2023

One reason why this plugin may be needed is that GitHub archive links do not contain submodules at this time.

A work around for now is to do the following:

use File::chdir;

share {
  ...
  plugin 'Download::Git';
  # Need to fetch the submodules too.
  meta->around_hook( fetch => sub {
    my $orig  = shift;
    my $build = shift;
    my $data  = $orig->($build, @_);

    if( $data->{type} eq 'file' ) {
      local $CWD = $data->{path};
      $build->log("In $CWD");
      $build->system(
        '%{git}',
        qw(submodule update),
        qw(--init --recursive),
      );
    }

    return $data;
  });
}
@plicease
Copy link
Member

Seems reasonable.

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

No branches or pull requests

2 participants