summaryrefslogtreecommitdiff
path: root/init-repository
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-11-25 20:07:05 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-11-30 15:12:13 +0000
commit150071b395e7c81a9af08469f4cb2f69c2838480 (patch)
tree404c6ef2779ddb093cd200ea94bce36ba89e2c82 /init-repository
parent977f0841e46f9a4249526f93cbfbf540210c76e6 (diff)
downloadqt5-150071b395e7c81a9af08469f4cb2f69c2838480.tar.gz
don't fail to check out some modules in pinned mode
when used without the --branch option, we clone with --no-checkout, to avoid unnecessarily checking out files twice when the recorded sha1 doesn't happen to be the tip of the default branch. however, that would leave the index in a dirty state which would make the subsequent submodule update abort at some point, silently. to deal with the problem, we ignore this type of index dirtyness and use submodule update with --force. Task-number: QTBUG-57289 Change-Id: I6fc9693b0eaadfb04d2d80f9c8f1f2e11be47ae9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'init-repository')
-rwxr-xr-xinit-repository9
1 files changed, 8 insertions, 1 deletions
diff --git a/init-repository b/init-repository
index 5c76a31c..7a97c199 100755
--- a/init-repository
+++ b/init-repository
@@ -424,7 +424,7 @@ sub git_clone_all_submodules
}
}
if ($self->{update}) {
- my @cmd = ('git', 'submodule', 'update', '--no-fetch');
+ my @cmd = ('git', 'submodule', 'update', '--force', '--no-fetch');
push @cmd, '--remote', '--rebase' if ($co_branch);
$self->exe(@cmd);
@@ -471,6 +471,13 @@ sub git_stat_one_submodule
my @sts = qx(git status --porcelain --untracked=no);
+ # After a git clone --no-checkout, git status reports all files as
+ # staged for deletion, but we still want to update the submodule.
+ # It's unlikely that a genuinely dirty index would have _only_ this
+ # type of modifications, and it doesn't seem like a horribly big deal
+ # to lose them anyway, so ignore them.
+ @sts = grep(!/^D /, @sts);
+
chdir($orig_cwd) or confess "cd $orig_cwd: $OS_ERROR";
return 0 if (!@sts);