always reconfigure all remotes

otherwise changing the user name or the remote type will be not be
possible.

Change-Id: I56a3790abbcf39cb4e75ac752af79581ed4c6e10
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2011-11-09 17:38:49 +01:00 committed by Qt by Nokia
parent 4cbe91304a
commit c88e4747ad
1 changed files with 9 additions and 32 deletions

View File

@ -513,14 +513,8 @@ sub git_add_remotes
{
my ($self, $repo_basename) = @_;
my %current_remotes;
for my $line (qx(git remote show)) {
chomp $line;
$current_remotes{$line} = 1;
}
my $gerrit_repo_basename = $GERRIT_REPOS{$repo_basename};
if ($gerrit_repo_basename && !$current_remotes{'gerrit'}) {
if ($gerrit_repo_basename) {
my $gerrit_repo_url;
# If given a username, make a "verbose" remote.
@ -536,19 +530,8 @@ sub git_add_remotes
}
$gerrit_repo_url .= $gerrit_repo_basename;
$self->exe('git', 'remote', 'add', 'gerrit', $gerrit_repo_url);
$current_remotes{'gerrit'} = 1;
}
# if repo still has no gerrit repo defined, alias it to origin
if (!$current_remotes{'gerrit'}) {
my @configresult = qx(git remote -v);
foreach (@configresult) {
if (/^origin\s+(\S+) \(fetch\)/) {
$self->exe('git', 'remote', 'add', 'gerrit', $1);
}
}
$self->exe('git', 'config', 'remote.gerrit.url', $gerrit_repo_url);
$self->exe('git', 'config', 'remote.gerrit.fetch', '+refs/heads/*:refs/remotes/gerrit/*');
}
return;
@ -593,6 +576,12 @@ sub git_clone_one_submodule
chdir($submodule) or confess "chdir $submodule: $OS_ERROR";
$self->exe('git', 'config', 'remote.origin.url', $url);
if ($mirror) {
$self->exe('git', 'config', 'remote.mirror.url', $mirror);
$self->exe('git', 'config', 'remote.mirror.fetch', '+refs/heads/*:refs/remotes/mirror/*');
}
if (!$do_clone) {
$self->exe('git', 'fetch', ($mirror ? $mirror : $url));
}
@ -602,18 +591,6 @@ sub git_clone_one_submodule
$self->exe('git', 'config', 'commit.template', $template);
}
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);
}
$self->git_add_remotes($submodule);
if ($self->{'detach-alternates'}) {