aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-03-04 12:03:54 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-03-04 12:23:13 +0100
commitac6168c0cb00b32a644509645cb77e33470c4e2c (patch)
treea09dab5c408abb087811a5a479458e1453f5f5cb
parentbe35b9f9af23a2b84ccab7e24b10e70d9324e42b (diff)
use git clone --branch instead of --no-checkout
git submodule update does not cause an actual checkout if HEAD matches the recorded submodule sha1 even if it was not actually checked out. it would be possible to work around this by calling git checkout HEAD in each submodule if no files are checked out, but that seems hacky. instead, just make the module cloning already check out the desired branch. this produces checkouts that are within a few commits of the final sha1, so isn't too bad. Change-Id: I435c1a2e24f39fd8c0d65f0d90df0216715668b7
-rwxr-xr-xinit-repository7
1 files changed, 4 insertions, 3 deletions
diff --git a/init-repository b/init-repository
index 9a08406e..581d108e 100755
--- a/init-repository
+++ b/init-repository
@@ -383,7 +383,7 @@ sub git_clone_all_submodules
}
foreach my $module (@modules) {
- $self->git_clone_one_submodule($subdirs{$module}, $subbases{$module});
+ $self->git_clone_one_submodule($subdirs{$module}, $subbases{$module}, $subbranches{$module});
}
if ($co_branch) {
@@ -440,7 +440,7 @@ sub git_add_remotes
sub git_clone_one_submodule
{
- my ($self, $submodule, $repo_basename) = @_;
+ my ($self, $submodule, $repo_basename, $branch) = @_;
my $alternates = $self->{ 'alternates' };
my $mirror_url = $self->{ 'mirror-url' };
@@ -476,7 +476,8 @@ sub git_clone_one_submodule
my $do_clone = (! -e "$submodule/.git");
if ($do_clone) {
- $self->exe('git', 'clone', '--no-checkout', @reference_args,
+ push @reference_args, '--branch', $branch if ($branch);
+ $self->exe('git', 'clone', @reference_args,
($mirror ? $mirror : $url), $submodule);
}