{"thread":{"id":"22068","subject":"[PATCH] Fix \"git remote update\" with remotes.defalt set","startedAt":"2009-12-31T09:43:17Z","lastAt":"2009-12-31T09:43:17Z","messageCount":1,"participants":["Björn Gustavsson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"130597","messageId":"4B3C7235.2030707@gmail.com","threadId":"22068","inReplyTo":null,"subject":"[PATCH] Fix \"git remote update\" with remotes.defalt set","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2009-12-31T09:43:17Z","receivedAt":"2009-12-31T09:43:17Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"Starting from commit 8db35596, \"git remote update\" (with no\ngroup name given) will fail with the following message if\nremotes.default has been set in the config file:\n\nfatal: 'default' does not appear to be a git repository\nfatal: The remote end hung up unexpectedly\n\nThe problem is that the --multiple option is not passed to\n\"git fetch\" if no remote or group name is given on the command\nline. Fix the problem by always passing the --multiple\noption to \"git fetch\" (which actually simplifies the code).\n\nReported-by: YONETANI Tomokazu\n\nSigned-off-by: Björn Gustavsson <bgustavsson@gmail.com>\n---\n builtin-remote.c  |   10 ++++------\n t/t5505-remote.sh |   14 ++++++++++++++\n 2 files changed, 18 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex a501939..c4945b8 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -1238,13 +1238,11 @@ static int update(int argc, const char **argv)\n \t\tfetch_argv[fetch_argc++] = \"--prune\";\n \tif (verbose)\n \t\tfetch_argv[fetch_argc++] = \"-v\";\n-\tif (argc < 2) {\n+\tfetch_argv[fetch_argc++] = \"--multiple\";\n+\tif (argc < 2)\n \t\tfetch_argv[fetch_argc++] = \"default\";\n-\t} else {\n-\t\tfetch_argv[fetch_argc++] = \"--multiple\";\n-\t\tfor (i = 1; i < argc; i++)\n-\t\t\tfetch_argv[fetch_argc++] = argv[i];\n-\t}\n+\tfor (i = 1; i < argc; i++)\n+\t\tfetch_argv[fetch_argc++] = argv[i];\n \n \tif (strcmp(fetch_argv[fetch_argc-1], \"default\") == 0) {\n \t\tgit_config(get_remote_default, &default_defined);\ndiff --git a/t/t5505-remote.sh b/t/t5505-remote.sh\nindex fd166d9..936fe0a 100755\n--- a/t/t5505-remote.sh\n+++ b/t/t5505-remote.sh\n@@ -419,6 +419,20 @@ test_expect_success 'update default (overridden, with funny whitespace)' '\n \n '\n \n+test_expect_success 'update (with remotes.default defined)' '\n+\n+\t(cd one &&\n+\t for b in $(git branch -r)\n+\t do\n+\t\tgit branch -r -d $b || break\n+\t done &&\n+\t git config remotes.default \"drosophila\" &&\n+\t git remote update &&\n+\t git branch -r > output &&\n+\t test_cmp expect output)\n+\n+'\n+\n test_expect_success '\"remote show\" does not show symbolic refs' '\n \n \tgit clone one three &&\n-- \n1.6.6.69.gc18d\n"}]}