Skip to content

Add option to clone submodules recursively #12

@zmughal

Description

@zmughal

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;
  });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions