Skip to content

Commit 66276d9

Browse files
committed
Merge branch 'bg/maint-remote-update-default' into maint
* bg/maint-remote-update-default: Fix "git remote update" with remotes.defalt set
2 parents ce67b3e + 4f2e842 commit 66276d9

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

builtin-remote.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,13 +1238,11 @@ static int update(int argc, const char **argv)
12381238
fetch_argv[fetch_argc++] = "--prune";
12391239
if (verbose)
12401240
fetch_argv[fetch_argc++] = "-v";
1241-
if (argc < 2) {
1241+
fetch_argv[fetch_argc++] = "--multiple";
1242+
if (argc < 2)
12421243
fetch_argv[fetch_argc++] = "default";
1243-
} else {
1244-
fetch_argv[fetch_argc++] = "--multiple";
1245-
for (i = 1; i < argc; i++)
1246-
fetch_argv[fetch_argc++] = argv[i];
1247-
}
1244+
for (i = 1; i < argc; i++)
1245+
fetch_argv[fetch_argc++] = argv[i];
12481246

12491247
if (strcmp(fetch_argv[fetch_argc-1], "default") == 0) {
12501248
git_config(get_remote_default, &default_defined);

t/t5505-remote.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,20 @@ test_expect_success 'update default (overridden, with funny whitespace)' '
419419
420420
'
421421

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+
422436
test_expect_success '"remote show" does not show symbolic refs' '
423437
424438
git clone one three &&

0 commit comments

Comments
 (0)