aboutsummaryrefslogtreecommitdiffstats
path: root/init-repository
diff options
context:
space:
mode:
authorMarius Storm-Olsen <marius.storm-olsen@nokia.com>2011-06-01 12:17:41 -0500
committerMarius Storm-Olsen <marius.storm-olsen@nokia.com>2011-06-01 12:17:41 -0500
commitda3eb5c7ec24e306fce5dabb3988243d8462e44a (patch)
tree885f64286c53ad869f2ee6e408df14de0b04bd04 /init-repository
parent5d54ac9bb02e420d28d4b784fc99503c23fbaab1 (diff)
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.
Diffstat (limited to 'init-repository')
-rwxr-xr-xinit-repository30
1 files changed, 21 insertions, 9 deletions
diff --git a/init-repository b/init-repository
index 999fdf96..47371be0 100755
--- a/init-repository
+++ b/init-repository
@@ -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});
+ 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);
+ }
+ }
+ }
+ } 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/,;
+ 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,;
}
- $staging_repo_url =~ s,^git://gitorious\.org/,$url_base_for_protocol,;
+ $self->exe('git', 'remote', 'add', 'staging', $staging_repo_url);
}
- $self->exe('git', 'remote', 'add', 'staging', $staging_repo_url);
}
return;