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>
Junio C Hamano committed
Sep 16, 2011 at 11:14 UTC
91a640ffb6d9dd10c293a575a692d9771b6e13c7
1 file changed
+3
builtin/ls-remote.c
+3
@@ -41,6 +41,9 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
41
struct transport *transport;
42
const struct ref *ref;
43
44
+ if (argc == 2 && !strcmp("-h", argv[1]))
45
+ usage(ls_remote_usage);
46
+
47
for (i = 1; i < argc; i++) {
48
const char *arg = argv[i];
49