summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-05-08 22:37:28 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-05-08 22:37:28 -0700
commit909376a1c9078b7bb7b420113efa956b130e8809 (patch)
tree5710d5b444a0254759e02ffec8ee44de8fa5cabc /builtin
parentMerge branch 'rc/maint-curl-helper' (diff)
parentls-remote: fall-back to default remotes when no remote specified (diff)
downloadtgif-909376a1c9078b7bb7b420113efa956b130e8809.tar.xz
Merge branch 'rc/ls-remote-default'
* rc/ls-remote-default: ls-remote: fall-back to default remotes when no remote specified
Diffstat (limited to 'builtin')
-rw-r--r--builtin/ls-remote.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index 70f5622d9d..8ee91eb547 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -4,7 +4,8 @@
#include "remote.h"
static const char ls_remote_usage[] =
-"git ls-remote [--heads] [--tags] [-u <exec> | --upload-pack <exec>] <repository> <refs>...";
+"git ls-remote [--heads] [--tags] [-u <exec> | --upload-pack <exec>]\n"
+" [<repository> [<refs>...]]";
/*
* Is there one among the list of patterns that match the tail part
@@ -73,9 +74,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
break;
}
- if (!dest)
- usage(ls_remote_usage);
-
if (argv[i]) {
int j;
pattern = xcalloc(sizeof(const char *), argc - i + 1);
@@ -87,6 +85,11 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
}
}
remote = remote_get(dest);
+ if (!remote) {
+ if (dest)
+ die("bad repository '%s'", dest);
+ die("No remote configured to list refs from.");
+ }
if (!remote->url_nr)
die("remote %s has no configured URL", dest);
transport = transport_get(remote, NULL);