git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Gustavsson" <bgustavsson@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] Fix "git remote update" with remotes.defalt set
Date: Thu, 31 Dec 2009 10:43:17 +0100	[thread overview]
Message-ID: <4B3C7235.2030707@gmail.com> (raw)

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>
---
 builtin-remote.c  |   10 ++++------
 t/t5505-remote.sh |   14 ++++++++++++++
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/builtin-remote.c b/builtin-remote.c
index a501939..c4945b8 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -1238,13 +1238,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);
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index fd166d9..936fe0a 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -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 &&
-- 
1.6.6.69.gc18d

                 reply	other threads:[~2009-12-31  9:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B3C7235.2030707@gmail.com \
    --to=bgustavsson@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).