Skip to content

Commit

Permalink
init-repo: Resolve alternate url for git sub-submodules
Browse files Browse the repository at this point in the history
Do set correct --alternates argument for sub-submodules like
qtwebengine/src/3rdparty. So far these repositories were always
fully cloned from remote (or the mirror).

Fixes: QTBUG-61901
Change-Id: I19f5930a03ab9050b6e62ac5a5c78780d0544e03
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
  • Loading branch information
kkoehne committed Sep 13, 2018
1 parent e866953 commit 6dfe5c3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions init-repository
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ use constant {

sub git_clone_all_submodules
{
my ($self, $my_repo_base, $co_branch, @subset) = @_;
my ($self, $my_repo_base, $co_branch, $alternates, @subset) = @_;

my %subdirs = ();
my %subbranches = ();
Expand Down Expand Up @@ -406,7 +406,7 @@ sub git_clone_all_submodules

foreach my $module (@modules) {
$self->git_clone_one_submodule($subdirs{$module}, $subbases{$module},
$co_branch && $subbranches{$module});
$co_branch && $subbranches{$module}, $alternates);
}

if ($co_branch) {
Expand Down Expand Up @@ -434,7 +434,7 @@ sub git_clone_all_submodules
if (-f $module.'/.gitmodules') {
my $orig_cwd = getcwd();
chdir($module) or confess "chdir $module: $OS_ERROR";
$self->git_clone_all_submodules($subbases{$module}, 0, "all");
$self->git_clone_all_submodules($subbases{$module}, 0, "$alternates/$module", "all");
chdir("$orig_cwd") or confess "chdir $orig_cwd: $OS_ERROR";
}
}
Expand Down Expand Up @@ -491,9 +491,8 @@ sub git_stat_one_submodule

sub git_clone_one_submodule
{
my ($self, $submodule, $repo_basename, $branch) = @_;
my ($self, $submodule, $repo_basename, $branch, $alternates) = @_;

my $alternates = $self->{ 'alternates' };
my $mirror_url = $self->{ 'mirror-url' };
my $protocol = $self->{ 'protocol' };

Expand Down Expand Up @@ -643,7 +642,7 @@ sub run
$url =~ s/qt5$//;
$self->{'base-url'} = $url;

$self->git_clone_all_submodules('qt5', $self->{branch}, @{$self->{'module-subset'}});
$self->git_clone_all_submodules('qt5', $self->{branch}, $self->{alternates}, @{$self->{'module-subset'}});

$self->git_add_remotes('qt5');

Expand Down

0 comments on commit 6dfe5c3

Please sign in to comment.