From: Finn Arne Gangstad Date: Mon, 6 Apr 2009 13:41:02 +0000 (+0200) Subject: git remote update: Fallback to remote if group does not exist X-Git-Tag: v1.6.3-rc0~5^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b344e1614b15dfde0ab4dfc175bed1aac39bc264;p=git.git git remote update: Fallback to remote if group does not exist Previously, git remote update 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 ..." to fetch and prune one or more remotes, for example. Signed-off-by: Finn Arne Gangstad Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt index 0b6e67dbc..9e2b4eaa3 100644 --- a/Documentation/git-remote.txt +++ b/Documentation/git-remote.txt @@ -16,7 +16,7 @@ SYNOPSIS 'git remote set-head' [-a | -d | ] 'git remote show' [-n] 'git remote prune' [-n | --dry-run] -'git remote update' [-p | --prune] [group] +'git remote update' [-p | --prune] [group | remote]... DESCRIPTION ----------- diff --git a/builtin-remote.c b/builtin-remote.c index 51df99ba9..ca7c639ad 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"))