summaryrefslogtreecommitdiff
path: root/builtin-ls-remote.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2009-11-04 02:38:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-11-04 05:39:28 (GMT)
commitc1d45cf7b0c1953eed72a3018b5e557dbcd538e0 (patch)
tree1840f9d24721f43b1a8c3b693b3c75410529d08b /builtin-ls-remote.c
parentb26f39cd9739ea1b4149c7ff79469d953440c913 (diff)
downloadgit-c1d45cf7b0c1953eed72a3018b5e557dbcd538e0.zip
git-c1d45cf7b0c1953eed72a3018b5e557dbcd538e0.tar.gz
git-c1d45cf7b0c1953eed72a3018b5e557dbcd538e0.tar.bz2
Require a struct remote in transport_get()
cmd_ls_remote() was calling transport_get() with a NULL remote and a non-NULL url in the case where it was run outside a git repository. This involved a bunch of ill-tested special cases. Instead, simply get the struct remote for the URL with remote_get(), which works fine outside a git repository, and can also take global options into account. This fixes a tiny and obscure bug where "git ls-remote" without a repo didn't support global url.*.insteadOf, even though "git clone" and "git ls-remote" in any repo did. Also, enforce that all callers provide a struct remote to transport_get(). Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-ls-remote.c')
-rw-r--r--builtin-ls-remote.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c
index 78a88f7..b5bad0c 100644
--- a/builtin-ls-remote.c
+++ b/builtin-ls-remote.c
@@ -86,10 +86,10 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
pattern[j - i] = p;
}
}
- remote = nongit ? NULL : remote_get(dest);
- if (remote && !remote->url_nr)
+ remote = remote_get(dest);
+ if (!remote->url_nr)
die("remote %s has no configured URL", dest);
- transport = transport_get(remote, remote ? remote->url[0] : dest);
+ transport = transport_get(remote, remote->url[0]);
if (uploadpack != NULL)
transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack);