diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-06 17:12:16 +1000 |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-06 17:22:45 +1000 |
commit | caba93a9a672e575e8621d0b4a8b5800769794e9 (patch) | |
tree | e2fa76f15fdc7967c38a489f5404df0438373f3e /init-repository | |
parent | 65ac36828a880b87345a071adbebc50906726073 (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-x | init-repository | 7 |
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); } |