{"thread":{"id":"21535","subject":"[RFC/PATCH 2/4] Teach the --multiple option to 'git fetch'","startedAt":"2009-11-08T15:46:38Z","lastAt":"2009-11-09T06:25:05Z","messageCount":4,"participants":["Björn Gustavsson","Jay Soffian","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"127083","messageId":"4AF6E7DE.1020201@gmail.com","threadId":"21535","inReplyTo":null,"subject":"[RFC/PATCH 2/4] Teach the --multiple option to 'git fetch'","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2009-11-08T15:46:38Z","receivedAt":"2009-11-08T15:46:38Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"Add the --multiple option to specify that all arguments are either\ngroups or remotes. The primary reason for adding this option is\nto allow us to re-implement 'git remote update' using fetch.\n\nSigned-off-by: Björn Gustavsson <bgustavsson@gmail.com>\n---\n builtin-fetch.c |   10 +++++++++-\n 1 files changed, 9 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex a520c1b..7926658 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -24,7 +24,7 @@ enum {\n \tTAGS_SET = 2\n };\n \n-static int all, append, force, keep, update_head_ok, verbosity;\n+static int all, append, force, keep, multiple, update_head_ok, verbosity;\n static int tags = TAGS_DEFAULT;\n static const char *depth;\n static const char *upload_pack;\n@@ -41,6 +41,8 @@ static struct option builtin_fetch_options[] = {\n \t\t   \"path to upload pack on remote end\"),\n \tOPT_BOOLEAN('f', \"force\", &force,\n \t\t    \"force overwrite of local branch\"),\n+\tOPT_BOOLEAN('m', \"multiple\", &multiple,\n+\t\t    \"fetch from multiple remotes\"),\n \tOPT_SET_INT('t', \"tags\", &tags,\n \t\t    \"fetch all tags and associated objects\", TAGS_SET),\n \tOPT_SET_INT('n', NULL, &tags,\n@@ -838,6 +840,12 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)\n \t\t/* No arguments -- use default remote */\n \t\tremote = remote_get(NULL);\n \t\tresult = fetch_one(remote, argc, argv);\n+\t} else if (multiple) {\n+\t\t/* All arguments are assumed to be remotes or groups */\n+\t\tfor (i = 0; i < argc; i++)\n+\t\t\tif (!add_remote_or_group(argv[i], &list))\n+\t\t\t\tdie(\"No such remote or remote group: %s\", argv[i]);\n+\t\tresult = fetch_multiple(&list);\n \t} else {\n \t\t/* Single remote or group */\n \t\t(void) add_remote_or_group(argv[0], &list);\n-- \n1.6.5.1.69.g36942\n"},{"id":"127111","messageId":"76718490911081659u318ea362l29342a9b3d90f03f@mail.gmail.com","threadId":"21535","inReplyTo":"4AF6E7DE.1020201@gmail.com","subject":"Re: [RFC/PATCH 2/4] Teach the --multiple option to 'git fetch'","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-11-09T00:59:46Z","receivedAt":"2009-11-09T00:59:46Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"2009/11/8 Björn Gustavsson <bgustavsson@gmail.com>:\n> Add the --multiple option to specify that all arguments are either\n> groups or remotes. The primary reason for adding this option is\n> to allow us to re-implement 'git remote update' using fetch.\n\nCan't this be determined automagically by inspecting the arguments? I\nbelieve there can be two unambiguous usages:\n\na) git fetch <repository> <refspec>...\nb) git fetch <repository>...\n\nIf there is more than one argument, either:\n\na) arguments 2...N must be refpecs (i.e., each must contain a colon)\nb) arguments 2...N must NOT be refspecs\n\n\"The format of a <refspec> parameter is an optional plus +, followed\nby the source ref <src>, followed by a colon :, followed by the\ndestination ref <dst>.\"\n\nj.\n"},{"id":"127112","messageId":"20091109010824.GA17414@coredump.intra.peff.net","threadId":"21535","inReplyTo":"76718490911081659u318ea362l29342a9b3d90f03f@mail.gmail.com","subject":"Re: [RFC/PATCH 2/4] Teach the --multiple option to 'git fetch'","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-11-09T01:08:24Z","receivedAt":"2009-11-09T01:08:24Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Nov 08, 2009 at 07:59:46PM -0500, Jay Soffian wrote:\n\n> 2009/11/8 Björn Gustavsson <bgustavsson@gmail.com>:\n> > Add the --multiple option to specify that all arguments are either\n> > groups or remotes. The primary reason for adding this option is\n> > to allow us to re-implement 'git remote update' using fetch.\n> \n> Can't this be determined automagically by inspecting the arguments? I\n> believe there can be two unambiguous usages:\n> [...]\n> \"The format of a <refspec> parameter is an optional plus +, followed\n> by the source ref <src>, followed by a colon :, followed by the\n> destination ref <dst>.\"\n\nIsn't the colon optional, indicating that the ref should be fetched into\nFETCH_HEAD? I.e.,\n\n  $ git fetch origin pu\n  From git://git2.kernel.org/pub/scm/git/git\n   * branch            pu         -> FETCH_HEAD\n\n?\n\n-Peff\n"},{"id":"127119","messageId":"6672d0160911082225v333488d1p906e6846df59b768@mail.gmail.com","threadId":"21535","inReplyTo":"20091109010824.GA17414@coredump.intra.peff.net","subject":"Re: [RFC/PATCH 2/4] Teach the --multiple option to 'git fetch'","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2009-11-09T06:25:05Z","receivedAt":"2009-11-09T06:25:05Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"2009/11/9 Jeff King <peff@peff.net>:\n> Isn't the colon optional, indicating that the ref should be fetched into\n> FETCH_HEAD?\n\nYes, that's why I was forced to invent a new option.\n\n-- \nBjörn Gustavsson, Erlang/OTP, Ericsson AB\n"}]}