Merge branch 'sp/smart-http'
[gitweb.git] / builtin-grep.c
index 1df25b07b573301bba7fdcb3b13d1af9050f513e..01be9bf7ff74731969384cc91dad2e20d08d81bc 100644 (file)
@@ -788,6 +788,13 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
 
+       /*
+        * 'git grep -h', unlike 'git grep -h <pattern>', is a request
+        * to show usage information and exit.
+        */
+       if (argc == 2 && !strcmp(argv[1], "-h"))
+               usage_with_options(grep_usage, options);
+
        memset(&opt, 0, sizeof(opt));
        opt.prefix = prefix;
        opt.prefix_length = (prefix && *prefix) ? strlen(prefix) : 0;