summaryrefslogtreecommitdiff
path: root/builtin-remote.c
diff options
context:
space:
mode:
authorLibravatar Finn Arne Gangstad <finnag@pvv.org>2009-04-06 15:41:02 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-04-07 21:52:26 -0700
commitb344e1614b15dfde0ab4dfc175bed1aac39bc264 (patch)
treef10a28791949617e5075d635fb67ecb851d0e121 /builtin-remote.c
parentremote: New function remote_is_configured() (diff)
downloadtgif-b344e1614b15dfde0ab4dfc175bed1aac39bc264.tar.xz
git remote update: Fallback to remote if group does not exist
Previously, git remote update <remote> would fail unless there was a remote group configured with the same name as the remote. git remote update will now fall back to using the remote if no matching group can be found. This enables "git remote update -p <remote>..." to fetch and prune one or more remotes, for example. Signed-off-by: Finn Arne Gangstad <finnag@pvv.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-remote.c')
-rw-r--r--builtin-remote.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/builtin-remote.c b/builtin-remote.c
index 51df99ba93..ca7c639ad3 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -1232,8 +1232,14 @@ static int update(int argc, const char **argv)
int groups_found = 0;
remote_group.name = argv[i];
result = git_config(get_remote_group, &groups_found);
- if (!groups_found && (i != 1 || strcmp(argv[1], "default")))
- die("No such remote group: '%s'", argv[i]);
+ if (!groups_found && (i != 1 || strcmp(argv[1], "default"))) {
+ struct remote *remote;
+ if (!remote_is_configured(argv[i]))
+ die("No such remote or remote group: %s",
+ argv[i]);
+ remote = remote_get(argv[i]);
+ string_list_append(remote->name, remote_group.list);
+ }
}
if (!result && !list.nr && argc == 2 && !strcmp(argv[1], "default"))