mirror of
git://code.qt.io/qt/qt5.git
synced 2026-02-01 19:36:04 +08:00
make manual fetching sane
it is in no way said that the remote's HEAD will contain the commit to be checked out - in fact, it's pretty much guaranteed that it won't for anything but the default branch. fetching the whole remote avoids additional roundtrips and makes the --branch feature actually work reasonably. Change-Id: I20de2da848b12aea8c5b2784307fe9860252009b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This commit is contained in:
committed by
Simon Hausmann
parent
d553fc4fa9
commit
1ad0a17fa0
@@ -482,14 +482,23 @@ sub git_clone_one_submodule
|
||||
my $orig_cwd = getcwd();
|
||||
chdir($submodule) or confess "chdir $submodule: $OS_ERROR";
|
||||
|
||||
$self->exe('git', 'config', 'remote.origin.url', $url);
|
||||
if ($mirror) {
|
||||
# This is only for the user's convenience - we make no use of it.
|
||||
$self->exe('git', 'config', 'remote.mirror.url', $mirror);
|
||||
$self->exe('git', 'config', 'remote.mirror.fetch', '+refs/heads/*:refs/remotes/mirror/*');
|
||||
}
|
||||
|
||||
if (!$do_clone && $self->{update}) {
|
||||
$self->exe('git', 'fetch', ($mirror ? $mirror : $url));
|
||||
# If we didn't clone, fetch from the right location. We always update
|
||||
# the origin remote, so that submodule update --remote works.
|
||||
$self->exe('git', 'config', 'remote.origin.url', ($mirror ? $mirror : $url));
|
||||
$self->exe('git', 'fetch', 'origin');
|
||||
}
|
||||
|
||||
if (!($do_clone || $self->{update}) || $mirror) {
|
||||
# Leave the origin configured to the canonical URL. It's already correct
|
||||
# if we cloned/fetched without a mirror; otherwise it may be anything.
|
||||
$self->exe('git', 'config', 'remote.origin.url', $url);
|
||||
}
|
||||
|
||||
my $template = getcwd()."/../.commit-template";
|
||||
|
||||
Reference in New Issue
Block a user