summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-09-16 18:14:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-09-16 18:19:43 (GMT)
commit91a640ffb6d9dd10c293a575a692d9771b6e13c7 (patch)
tree57d7b2bc83a467e8b5b6bdb22de36769b1ef7b98 /builtin
parent87b50542a08ac6caa083ddc376e674424e37940a (diff)
downloadgit-91a640ffb6d9dd10c293a575a692d9771b6e13c7.zip
git-91a640ffb6d9dd10c293a575a692d9771b6e13c7.tar.gz
git-91a640ffb6d9dd10c293a575a692d9771b6e13c7.tar.bz2
ls-remote: a lone "-h" is asking for help
What should happen if you run this command? $ git ls-remote -h It does not give a short-help for the command. Instead because "-h" is a synonym for "--heads", it runs "git ls-remote --heads", and because there is no remote specified on the command line, we run it against the default "origin" remote, hence end up doing the same as $ git ls-remote --heads origin Fix this counter-intuitive behaviour by special casing a lone "-h" that does not have anything else on the command line and calling usage(). Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/ls-remote.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index 97eed40..87d44bc 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -41,6 +41,9 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
struct transport *transport;
const struct ref *ref;
+ if (argc == 2 && !strcmp("-h", argv[1]))
+ usage(ls_remote_usage);
+
for (i = 1; i < argc; i++) {
const char *arg = argv[i];