summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-04-01 11:34:19 +0100
committerSimon Marlow <marlowsd@gmail.com>2011-04-01 11:34:19 +0100
commit7978575e0e3b3b4b8b838b88750fc0b4aef90bc1 (patch)
tree6aa6565e7c68a3bea2598f02199fcc23bb9aba8a
parentc5f09aed1e7de507007c31da7ab6f5576d9f7b6d (diff)
downloadhaskell-7978575e0e3b3b4b8b838b88750fc0b4aef90bc1.tar.gz
fix 'sync-all pull'
-rwxr-xr-xsync-all28
1 files changed, 22 insertions, 6 deletions
diff --git a/sync-all b/sync-all
index 87e3698d5a..6f786cd1aa 100755
--- a/sync-all
+++ b/sync-all
@@ -116,12 +116,25 @@ sub warning {
}
sub scm {
+ my $dir = shift;
my $scm = shift;
-
- message "== running $scm @_";
+ my $pwd;
+
+ if ($dir eq '.') {
+ message "== running $scm @_";
+ } else {
+ message "== $dir: running $scm @_";
+ $pwd = getcwd();
+ chdir($dir);
+ }
+
system ($scm, @_) == 0
or $ignore_failure
or die "$scm failed: $?";
+
+ if ($dir ne '.') {
+ chdir($pwd);
+ }
}
sub repoexists {
@@ -150,6 +163,8 @@ sub scmall {
my @scm_args;
+ my $pwd;
+
my ($repo_base, $checked_out_tree) = getrepo();
parsePackages;
@@ -231,19 +246,20 @@ sub scmall {
if (repoexists ($scm, $localpath)) {
if ($want_remote_repo) {
if ($scm eq "darcs") {
- scm ($scm, @scm_args, @_, "--repodir=$localpath", $path);
+ scm (".", $scm, @scm_args, @_, "--repodir=$localpath", $path);
} else {
# git pull doesn't like to be used with --work-dir
- scm ($scm, "--git-dir=$localpath/.git", @scm_args, @_, $path, "master");
+ # I couldn't find an alternative to chdir() here
+ scm ($localpath, $scm, @scm_args, @_, $path, "master");
}
} else {
# git status *must* be used with --work-dir, if we don't chdir() to the dir
- scm ($scm, "--git-dir=$localpath/.git", "--work-tree=$localpath", @scm_args, @_);
+ scm ($localpath, $scm, @scm_args, @_);
}
}
elsif ($local_repo_unnecessary) {
# Don't bother to change directory in this case
- scm ($scm, @scm_args, @_);
+ scm (".", $scm, @scm_args, @_);
}
elsif ($tag eq "") {
message "== Required repo $localpath is missing! Skipping";