@matheusbsbs / matheus-bagliano / commits / 4f2e842dd0
Fork 0

Fix "git remote update" with remotes.defalt set

Starting from commit 8db35596, "git remote update" (with no group name given) will fail with the following message if remotes.default has been set in the config file: fatal: 'default' does not appear to be a git repository fatal: The remote end hung up unexpectedly The problem is that the --multiple option is not passed to "git fetch" if no remote or group name is given on the command line. Fix the problem by always passing the --multiple option to "git fetch" (which actually simplifies the code). Reported-by: YONETANI Tomokazu Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Björn Gustavsson committed Dec 31, 2009 at 10:43 UTC 4f2e842dd0046a12bd82bb2b5aa066c686dc3f44
2 files changed +18 -6
builtin-remote.c
+4 -6
@@ -1206,13 +1206,11 @@ static int update(int argc, const char **argv)
1206 fetch_argv[fetch_argc++] = "--prune";
1207 if (verbose)
1208 fetch_argv[fetch_argc++] = "-v";
1209 - if (argc < 2) {
1209 + fetch_argv[fetch_argc++] = "--multiple";
1210 + if (argc < 2)
1211 fetch_argv[fetch_argc++] = "default";
1211 - } else {
1212 - fetch_argv[fetch_argc++] = "--multiple";
1213 - for (i = 1; i < argc; i++)
1214 - fetch_argv[fetch_argc++] = argv[i];
1215 - }
1212 + for (i = 1; i < argc; i++)
1213 + fetch_argv[fetch_argc++] = argv[i];
1214
1215 if (strcmp(fetch_argv[fetch_argc-1], "default") == 0) {
1216 git_config(get_remote_default, &default_defined);
t/t5505-remote.sh
+14
@@ -419,6 +419,20 @@ test_expect_success 'update default (overridden, with funny whitespace)' '
419
420 '
421
422 +test_expect_success 'update (with remotes.default defined)' '
423 +
424 + (cd one &&
425 + for b in $(git branch -r)
426 + do
427 + git branch -r -d $b || break
428 + done &&
429 + git config remotes.default "drosophila" &&
430 + git remote update &&
431 + git branch -r > output &&
432 + test_cmp expect output)
433 +
434 +'
435 +
436 test_expect_success '"remote show" does not show symbolic refs' '
437
438 git clone one three &&