summaryrefslogtreecommitdiff
path: root/init-repository
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-02-03 17:52:40 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-02-06 06:23:59 +0000
commitd553fc4fa9461b37b5275dcb556e3bdd1d93dedb (patch)
tree1663907e4fadec96c3e161571e6c5191ccd780f2 /init-repository
parentb236ef6aefae55165044567448073f1618b52806 (diff)
downloadqt5-d553fc4fa9461b37b5275dcb556e3bdd1d93dedb.tar.gz
always check out the target branch when using --branch
a submodule update with --remote will use the tip of the remote's branch, but it won't actually switch to the branch if HEAD doesn't point to it yet. Change-Id: If13e31da2646683dfb9e832eaab929190acb0167 Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
Diffstat (limited to 'init-repository')
-rwxr-xr-xinit-repository29
1 files changed, 15 insertions, 14 deletions
diff --git a/init-repository b/init-repository
index 6a7bd38e..b586110b 100755
--- a/init-repository
+++ b/init-repository
@@ -386,20 +386,7 @@ sub git_clone_all_submodules
$self->git_clone_one_submodule($subdirs{$module}, $subbases{$module});
}
- if ($self->{update}) {
- my @cmd = ('git', 'submodule', 'update');
- push @cmd, '--remote', '--rebase' if ($co_branch);
- $self->exe(@cmd);
-
- foreach my $module (@modules) {
- 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");
- chdir("$orig_cwd") or confess "chdir $orig_cwd: $OS_ERROR";
- }
- }
- } elsif ($co_branch) {
+ if ($co_branch) {
foreach my $module (@modules) {
my $branch = $subbranches{$module};
die("No branch defined for submodule $module.\n") if (!defined($branch));
@@ -414,6 +401,20 @@ sub git_clone_all_submodules
chdir("$orig_cwd") or confess "chdir $orig_cwd: $OS_ERROR";
}
}
+ if ($self->{update}) {
+ my @cmd = ('git', 'submodule', 'update');
+ push @cmd, '--remote', '--rebase' if ($co_branch);
+ $self->exe(@cmd);
+
+ foreach my $module (@modules) {
+ 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");
+ chdir("$orig_cwd") or confess "chdir $orig_cwd: $OS_ERROR";
+ }
+ }
+ }
return;
}