From 150071b395e7c81a9af08469f4cb2f69c2838480 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Nov 2016 20:07:05 +0100 Subject: 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 --- init-repository | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3