All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Teach git-remote to update existing remotes by fetching from them
@ 2007-02-19  4:00 Theodore Ts'o
  2007-02-19  5:18 ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Theodore Ts'o @ 2007-02-19  4:00 UTC (permalink / raw)
  To: git


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>
---
 Documentation/config.txt     |    4 ++++
 Documentation/git-remote.txt |   10 +++++++++-
 git-remote.perl              |   13 +++++++++++++
 3 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 3865535..d8e696f 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -439,6 +439,10 @@ pull.octopus::
 pull.twohead::
 	The default merge strategy to use when pulling a single branch.
 
+remote.fetch::
+	The list of remotes which are fetched by "git remote update".
+	See gitlink:git-remote[1].
+
 remote.<name>.url::
 	The URL of a remote repository.  See gitlink:git-fetch[1] or
 	gitlink:git-push[1].
diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index a60c31a..eed7aa2 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -13,6 +13,7 @@ SYNOPSIS
 'git-remote' add <name> <url>
 'git-remote' show <name>
 'git-remote' prune <name>
+'git-remote' update
 
 DESCRIPTION
 -----------
@@ -40,7 +41,14 @@ Gives some information about the remote <name>.
 
 Deletes all stale tracking branches under <name>.
 These stale branches have already been removed from the remote repository
-referenced by <name>, but are still locally available in "remotes/<name>".
+referenced by <name>, but are still locally available in
+"remotes/<name>".
+
+'update'::
+
+Fetch updates for the remotes in the repository.  By default all remotes
+are updated, but this can be configured via the configuration parameter 
+'remote.fetch'.   (See gitlink:git-config[1]).
 
 
 DISCUSSION
diff --git a/git-remote.perl b/git-remote.perl
index c56c5a8..1db9901 100755
--- a/git-remote.perl
+++ b/git-remote.perl
@@ -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);
 }
-- 
1.5.0.50.gb75812-dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-02-20 15:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-19  4:00 [PATCH] Teach git-remote to update existing remotes by fetching from them Theodore Ts'o
2007-02-19  5:18 ` Junio C Hamano
2007-02-19  7:32   ` Shawn O. Pearce
2007-02-19 11:05     ` Alex Riesen
2007-02-19 13:21       ` Jakub Narebski
     [not found]         ` <20070219201111.GA3407@steel.home>
2007-02-20 15:24           ` Jakub Narebski
2007-02-19 12:52     ` Theodore Tso
2007-02-19 20:09       ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.