From 4450693ac0f7c82d6efd99dbcaee5074ed36b4ca Mon Sep 17 00:00:00 2001 From: Li Xinwei <1326710505@qq.com> Date: Mon, 31 May 2021 17:45:52 +0800 Subject: Fix --mirror option for init-repository If submodule url is absolute, don't use mirror, don't set remote.gerrit.url and remote.gerrit.fetch. To avoid error when passing "--mirror git://github.com/qt/": fatal: remote error: qt/https://code.qt.io/playground/qlitehtml is not a valid repository name Visit https://support.github.com/ for help amends 7374ef8e38b6b47589ff4f2977f102fc63ab3d72 Change-Id: Ifb4e1c8de57c7729f2965c16388f1acd763a150f Reviewed-by: Kai Koehne --- init-repository | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'init-repository') diff --git a/init-repository b/init-repository index 0d5593b4..60594fc7 100755 --- a/init-repository +++ b/init-repository @@ -532,7 +532,7 @@ sub git_clone_one_submodule } my $mirror; - if ($mirror_url && ($do_clone || $self->{fetch})) { + if (!has_url_scheme($repo_basename) && $mirror_url && ($do_clone || $self->{fetch})) { $mirror = $mirror_url.$repo_basename; } @@ -582,7 +582,9 @@ sub git_clone_one_submodule $self->exe('git', 'config', 'commit.template', $template); } - $self->git_add_remotes($repo_basename); + if (!has_url_scheme($repo_basename)) { + $self->git_add_remotes($repo_basename); + } if ($self->{'detach-alternates'}) { $self->exe('git', 'repack', '-a'); -- cgit v1.2.3