Skip to content

Commit

Permalink
Fix "git remote update" with remotes.defalt set
Browse files Browse the repository at this point in the history
Starting from commit 8db3559, "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>
  • Loading branch information
Björn Gustavsson authored and Junio C Hamano committed Dec 31, 2009
1 parent 8db3559 commit 4f2e842
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
10 changes: 4 additions & 6 deletions builtin-remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,13 +1206,11 @@ static int update(int argc, const char **argv)
fetch_argv[fetch_argc++] = "--prune";
if (verbose)
fetch_argv[fetch_argc++] = "-v";
if (argc < 2) {
fetch_argv[fetch_argc++] = "--multiple";
if (argc < 2)
fetch_argv[fetch_argc++] = "default";
} else {
fetch_argv[fetch_argc++] = "--multiple";
for (i = 1; i < argc; i++)
fetch_argv[fetch_argc++] = argv[i];
}
for (i = 1; i < argc; i++)
fetch_argv[fetch_argc++] = argv[i];

if (strcmp(fetch_argv[fetch_argc-1], "default") == 0) {
git_config(get_remote_default, &default_defined);
Expand Down
14 changes: 14 additions & 0 deletions t/t5505-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,20 @@ test_expect_success 'update default (overridden, with funny whitespace)' '
'

test_expect_success 'update (with remotes.default defined)' '
(cd one &&
for b in $(git branch -r)
do
git branch -r -d $b || break
done &&
git config remotes.default "drosophila" &&
git remote update &&
git branch -r > output &&
test_cmp expect output)
'

test_expect_success '"remote show" does not show symbolic refs' '
git clone one three &&
Expand Down

0 comments on commit 4f2e842

Please sign in to comment.