summaryrefslogtreecommitdiffstats
path: root/init-repository
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-10-17 11:15:04 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-11-14 12:17:33 +0000
commit357d29a0028e5ef9f725bbbac682d1e2033b9d97 (patch)
tree3d3eadeff1c35aa7a3ae9563a0767ce064d6762c /init-repository
parentd9141a32be8566365f9582a0c09b626a811f62d1 (diff)
add --no-fetch option
there is no point in re-fetching all repositories just because an update failed due to local modifications. Change-Id: Ie9883586d77f3310058353844f0bbcfb0b775ebb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'init-repository')
-rwxr-xr-xinit-repository16
1 files changed, 12 insertions, 4 deletions
diff --git a/init-repository b/init-repository
index f7ba27e9..842af7d1 100755
--- a/init-repository
+++ b/init-repository
@@ -82,6 +82,9 @@ Options:
--no-update
Skip the `git submodule update' command.
+ --no-fetch
+ Skip the `git fetch' commands. Implied by --no-update.
+
--branch
Instead of checking out specific SHA1s, check out the submodule
branches that correspond with the current supermodule commit. By
@@ -213,6 +216,7 @@ sub parse_arguments
'ignore-submodules' => 0 ,
'mirror-url' => "",
'update' => 1 ,
+ 'fetch' => 1 ,
'module-subset' => "default",
);
@@ -227,6 +231,7 @@ sub parse_arguments
'mirror=s' => \$self->{qw{ mirror-url }},
'quiet' => \$self->{qw{ quiet }},
'update!' => \$self->{qw{ update }},
+ 'fetch!' => \$self->{qw{ fetch }},
'module-subset=s' => \$self->{qw{ module-subset }},
'help|?' => sub { printUsage(1); },
@@ -245,6 +250,8 @@ sub parse_arguments
$self->{'module-subset'} =~ s/\bdefault\b/preview,essential,addon,deprecated/;
$self->{'module-subset'} = [ split(/,/, $self->{'module-subset'}) ];
+ $self->{'fetch'} = 0 if (!$self->{'update'});
+
return;
}
@@ -466,9 +473,11 @@ sub git_clone_one_submodule
}
}
+ my $do_clone = (! -e "$submodule/.git");
+
my $url = $self->{'base-url'}.$repo_basename;
my $mirror;
- if ($mirror_url) {
+ if ($mirror_url && ($do_clone || $self->{fetch})) {
$mirror = $mirror_url.$repo_basename;
}
@@ -481,7 +490,6 @@ sub git_clone_one_submodule
}
}
- my $do_clone = (! -e "$submodule/.git");
if ($do_clone) {
if ($branch) {
push @reference_args, '--branch', $branch;
@@ -501,14 +509,14 @@ sub git_clone_one_submodule
$self->exe('git', 'config', 'remote.mirror.fetch', '+refs/heads/*:refs/remotes/mirror/*');
}
- if (!$do_clone && $self->{update}) {
+ if (!$do_clone && $self->{fetch}) {
# 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) {
+ if (!($do_clone || $self->{fetch}) || $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);