aboutsummaryrefslogtreecommitdiffstats
path: root/init-repository
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2011-05-06 17:12:16 +1000
committerRohan McGovern <rohan.mcgovern@nokia.com>2011-05-06 17:22:45 +1000
commitcaba93a9a672e575e8621d0b4a8b5800769794e9 (patch)
treee2fa76f15fdc7967c38a489f5404df0438373f3e /init-repository
parent65ac36828a880b87345a071adbebc50906726073 (diff)
init-repository: avoid failure when combining `--force' and mirrors
Avoid a fatal error if the `mirror' remote already exists. Reviewed-by: Sunil Thaha Change-Id: Id6225fad265abb575f6f35f750ba7aed7729e0dc
Diffstat (limited to 'init-repository')
-rwxr-xr-xinit-repository7
1 files changed, 7 insertions, 0 deletions
diff --git a/init-repository b/init-repository
index df3cf5f9..423fc856 100755
--- a/init-repository
+++ b/init-repository
@@ -479,6 +479,13 @@ sub git_clone_one_submodule
if ($mirror) {
$self->exe('git', 'config', 'remote.origin.url', $url);
+
+ # In `force' mode, remove the mirror if it already exists,
+ # since we may be reinitializing the module.
+ if ($self->{force}) {
+ eval { $self->exe('git', 'remote', 'rm', 'mirror'); }; # failure is OK
+ }
+
$self->exe('git', 'remote', 'add', 'mirror', $mirror);
}