Add 'staging' remote to repos which don't have a staging area

This makes it simpler to do
    git submodule foreach
commands, since you don't need to worry about the repos without
any staging area.
This commit is contained in:
Marius Storm-Olsen
2011-06-01 12:17:41 -05:00
parent 5d54ac9bb0
commit da3eb5c7ec

View File

@@ -428,18 +428,30 @@ sub git_add_staging_remote
my @staging = grep { /^$repo_basename$/; } keys %STAGING_REPOS;
foreach my $staging_repo (@staging) {
# nothing to do if remote already exists
next if ($current_remotes{$staging_repo});
my $staging_repo_url = $STAGING_REPOS{$staging_repo};
if ($protocol) {
if ($protocol ne 'http') {
$staging_repo_url =~ s,^git://gitorious\.org/qt-labs/,${url_base_for_protocol}qt/,;
if (!@staging) {
# Add origin's URL as staging's URL, since this repo has no separate staging area
unless ($current_remotes{'staging'}) {
my @configresult = qx(git remote -v);
foreach (@configresult) {
if (/origin\s+(\S+) \(fetch\)/) {
$self->exe('git', 'remote', 'add', 'staging', $1);
}
}
$staging_repo_url =~ s,^git://gitorious\.org/,$url_base_for_protocol,;
}
$self->exe('git', 'remote', 'add', 'staging', $staging_repo_url);
} else {
foreach my $staging_repo (@staging) {
# nothing to do if remote already exists
next if ($current_remotes{'staging'});
my $staging_repo_url = $STAGING_REPOS{$staging_repo};
if ($protocol) {
if ($protocol ne 'http') {
$staging_repo_url =~ s,^git://gitorious\.org/qt-labs/,${url_base_for_protocol}qt/,;
}
$staging_repo_url =~ s,^git://gitorious\.org/,$url_base_for_protocol,;
}
$self->exe('git', 'remote', 'add', 'staging', $staging_repo_url);
}
}
return;