summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b92c5f2)
raw | patch | inline | side by side (parent: b92c5f2)
author | Finn Arne Gangstad <finnag@pvv.org> | |
Fri, 3 Apr 2009 09:03:44 +0000 (11:03 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 5 Apr 2009 08:52:38 +0000 (01:52 -0700) |
With the --prune (or -p) option, git remote update will also prune
all the remotes that it fetches. Previously, you had to do a manual
git remote prune <remote> for each of the remotes you wanted to
prune, and this could be tedious with many remotes.
A single command will now update a set of remotes, and remove all
stale branches: git remote update -p [group]
Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
all the remotes that it fetches. Previously, you had to do a manual
git remote prune <remote> for each of the remotes you wanted to
prune, and this could be tedious with many remotes.
A single command will now update a set of remotes, and remove all
stale branches: git remote update -p [group]
Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-remote.txt | patch | blob | history | |
builtin-remote.c | patch | blob | history |
index c9c0e6f932909c53bc7041f540e7965f5da4efc7..0b6e67dbca2ed3c17222fd80007ddf42e7e8222f 100644 (file)
'git remote set-head' <name> [-a | -d | <branch>]
'git remote show' [-n] <name>
'git remote prune' [-n | --dry-run] <name>
-'git remote update' [group]
+'git remote update' [-p | --prune] [group]
DESCRIPTION
-----------
remotes.default is not defined, all remotes which do not have the
configuration parameter remote.<name>.skipDefaultUpdate set to true will
be updated. (See linkgit:git-config[1]).
++
+With `--prune` option, prune all the remotes that are updated.
DISCUSSION
diff --git a/builtin-remote.c b/builtin-remote.c
index c53966fd8d565f8328f9dd9c7146607d65ff7ae9..3146eb467d2c179867bfbcf12b690d07468c0534 100644 (file)
--- a/builtin-remote.c
+++ b/builtin-remote.c
"git remote set-head <name> [-a | -d | <branch>]",
"git remote show [-n] <name>",
"git remote prune [-n | --dry-run] <name>",
- "git remote [-v | --verbose] update [group]",
+ "git remote [-v | --verbose] update [-p | --prune] [group]",
NULL
};
static int update(int argc, const char **argv)
{
- int i, result = 0;
+ int i, result = 0, prune = 0;
struct string_list list = { NULL, 0, 0, 0 };
static const char *default_argv[] = { NULL, "default", NULL };
+ struct option options[] = {
+ OPT_GROUP("update specific options"),
+ OPT_BOOLEAN('p', "prune", &prune,
+ "prune remotes after fecthing"),
+ OPT_END()
+ };
+ argc = parse_options(argc, argv, options, builtin_remote_usage,
+ PARSE_OPT_KEEP_ARGV0);
if (argc < 2) {
argc = 2;
argv = default_argv;
if (!result && !list.nr && argc == 2 && !strcmp(argv[1], "default"))
result = for_each_remote(get_one_remote_for_update, &list);
- for (i = 0; i < list.nr; i++)
- result |= fetch_remote(list.items[i].string);
+ for (i = 0; i < list.nr; i++) {
+ int err = fetch_remote(list.items[i].string);
+ result |= err;
+ if (!err && prune)
+ result |= prune_remote(list.items[i].string, 0);
+ }
/* all names were strdup()ed or strndup()ed */
list.strdup_strings = 1;