@matheusbsbs / matheus-bagliano / commits / b344e1614b
Fork 0

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>

Finn Arne Gangstad committed Apr 6, 2009 at 15:41 UTC b344e1614b15dfde0ab4dfc175bed1aac39bc264
2 files changed +9 -3
Documentation/git-remote.txt
+1 -1
@@ -16,7 +16,7 @@ SYNOPSIS
16 'git remote set-head' <name> [-a | -d | <branch>]
17 'git remote show' [-n] <name>
18 'git remote prune' [-n | --dry-run] <name>
19 -'git remote update' [-p | --prune] [group]
19 +'git remote update' [-p | --prune] [group | remote]...
20
21 DESCRIPTION
22 -----------
builtin-remote.c
+8 -2
@@ -1232,8 +1232,14 @@ static int update(int argc, const char **argv)
1232 int groups_found = 0;
1233 remote_group.name = argv[i];
1234 result = git_config(get_remote_group, &groups_found);
1235 - if (!groups_found && (i != 1 || strcmp(argv[1], "default")))
1236 - die("No such remote group: '%s'", argv[i]);
1235 + if (!groups_found && (i != 1 || strcmp(argv[1], "default"))) {
1236 + struct remote *remote;
1237 + if (!remote_is_configured(argv[i]))
1238 + die("No such remote or remote group: %s",
1239 + argv[i]);
1240 + remote = remote_get(argv[i]);
1241 + string_list_append(remote->name, remote_group.list);
1242 + }
1243 }
1244
1245 if (!result && !list.nr && argc == 2 && !strcmp(argv[1], "default"))