fix cloning of tagged versions

the .gitmodules of tagged commits typically refers to a release branch
which was deleted shortly after the release. consequently, git clone
--branch is bound to fail.

of course, cloning a fixed sha1/tag requires no branch in the first
place, so revert back to using git clone --no-checkout in that case.

amends ac6168c0c.

Task-number: QTBUG-49133
Change-Id: Ica032f1d07a70ad89f16b23bdf5cdab785612fdc
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Oswald Buddenhagen
2016-11-02 18:59:19 +01:00
committed by Liang Qi
parent 4cbc319413
commit 71ed40b0ac

View File

@@ -389,7 +389,8 @@ sub git_clone_all_submodules
}
foreach my $module (@modules) {
$self->git_clone_one_submodule($subdirs{$module}, $subbases{$module}, $subbranches{$module});
$self->git_clone_one_submodule($subdirs{$module}, $subbases{$module},
$co_branch && $subbranches{$module});
}
if ($co_branch) {
@@ -482,7 +483,11 @@ sub git_clone_one_submodule
my $do_clone = (! -e "$submodule/.git");
if ($do_clone) {
push @reference_args, '--branch', $branch if ($branch);
if ($branch) {
push @reference_args, '--branch', $branch;
} else {
push @reference_args, '--no-checkout';
}
$self->exe('git', 'clone', @reference_args,
($mirror ? $mirror : $url), $submodule);
}