You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
576 B
30 lines
576 B
#!/usr/bin/env perl
|
|
|
|
use strict;
|
|
use Cwd;
|
|
|
|
my $cwd = getcwd;
|
|
my @repos;
|
|
|
|
for my $dir (<*/>) {
|
|
push @repos, $dir if -e "$dir/.git";
|
|
}
|
|
|
|
my $version = qx(git --version);
|
|
|
|
# what should we do about submodules?
|
|
|
|
for my $repo (@repos) {
|
|
chdir $repo;
|
|
print "Updating remotes for: $repo\n";
|
|
# this should detect if fetch --all works instead of version # bad juju
|
|
if ($version =~ /^(1\.6\.[6789]|[2-9]\.)/ ) {
|
|
system("git fetch --all");
|
|
} else {
|
|
system("git remote update");
|
|
}
|
|
|
|
chdir $cwd;
|
|
}
|
|
|
|
print "No git repos found\n" unless @repos;
|
|
|