summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87b5054)
raw | patch | inline | side by side (parent: 87b5054)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 16 Sep 2011 18:14:27 +0000 (11:14 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 16 Sep 2011 18:19:43 +0000 (11:19 -0700) |
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>
$ 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>
builtin/ls-remote.c | patch | blob | history |
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index 97eed4012ba23cfe7f13cf2b6c160ade54f6b2d1..87d44bc62512cb014a7410fc2ad4e9559fffb608 100644 (file)
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
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];