git wrapper: add --git-dir=<path> and --bare options
[gitweb.git] / builtin-help.c
index 7470faa56692e17608d202000b78a91565360b72..bc1b4da3bc0186487fac40173203cac91c1e3710 100644 (file)
@@ -12,7 +12,7 @@
 static const char git_usage[] =
        "Usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--help] COMMAND [ ARGS ]";
 
-/* most gui terms set COLUMNS (although some don't export it) */
+/* most GUI terminals set COLUMNS (although some don't export it) */
 static int term_columns(void)
 {
        char *col_string = getenv("COLUMNS");
@@ -229,7 +229,7 @@ int cmd_version(int argc, const char **argv, char **envp)
 
 int cmd_help(int argc, const char **argv, char **envp)
 {
-       const char *help_cmd = argv[1];
+       const char *help_cmd = argc > 1 ? argv[1] : NULL;
        if (!help_cmd)
                cmd_usage(0, git_exec_path(), NULL);
        else if (!strcmp(help_cmd, "--all") || !strcmp(help_cmd, "-a"))