Teach git-remote to update existing remotes by fetching from them

This allows users to use the command "git remote update" to update all
remotes that are being tracked in the repository.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Theodore Ts'o
2007-02-18 23:00:00 -05:00
committed by Junio C Hamano
parent 0bce7a52f2
commit 1e592d65b5
3 changed files with 26 additions and 1 deletions

View File

@ -303,6 +303,18 @@ elsif ($ARGV[0] eq 'show') {
show_remote($ARGV[$i], $ls_remote);
}
}
elsif ($ARGV[0] eq 'update') {
my $conf = $git->config("remote.fetch");
if (defined($conf)) {
@remotes = split(' ', $conf);
} else {
@remotes = sort keys %$remote;
}
for (@remotes) {
print "Fetching $_\n";
$git->command('fetch', "$_");
}
}
elsif ($ARGV[0] eq 'prune') {
my $ls_remote = 1;
my $i;
@ -360,5 +372,6 @@ else {
print STDERR " git remote add <name> <url>\n";
print STDERR " git remote show <name>\n";
print STDERR " git remote prune <name>\n";
print STDERR " git remote update\n";
exit(1);
}