summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-09-08 21:49:48 -0700
committerJunio C Hamano <gitster@pobox.com>2016-09-08 21:49:48 -0700
commitd7ed183a918bf6330d9036ca2d710d771b4b6198 (patch)
tree68ea17535b197ff110b0a306d4c6270475d6647d /git.c
parentda3b6f06e1224c9b8f5281a812731ef385ac4dc6 (diff)
parent2c6b6d9f7d8a26b6ae6493584cc3d2a3cbae7358 (diff)
downloadgit-d7ed183a918bf6330d9036ca2d710d771b4b6198.tar.gz
Merge branch 'rt/help-unknown'
"git nosuchcommand --help" said "No manual entry for gitnosuchcommand", which was not intuitive, given that "git nosuchcommand" said "git: 'nosuchcommand' is not a git command". * rt/help-unknown: help: make option --help open man pages only for Git commands help: introduce option --exclude-guides
Diffstat (limited to 'git.c')
-rw-r--r--git.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/git.c b/git.c
index 0f1937fd0c..1c61151758 100644
--- a/git.c
+++ b/git.c
@@ -522,21 +522,34 @@ static void strip_extension(const char **argv)
static void handle_builtin(int argc, const char **argv)
{
+ struct argv_array args = ARGV_ARRAY_INIT;
const char *cmd;
struct cmd_struct *builtin;
strip_extension(argv);
cmd = argv[0];
- /* Turn "git cmd --help" into "git help cmd" */
+ /* Turn "git cmd --help" into "git help --exclude-guides cmd" */
if (argc > 1 && !strcmp(argv[1], "--help")) {
+ int i;
+
argv[1] = argv[0];
argv[0] = cmd = "help";
+
+ for (i = 0; i < argc; i++) {
+ argv_array_push(&args, argv[i]);
+ if (!i)
+ argv_array_push(&args, "--exclude-guides");
+ }
+
+ argc++;
+ argv = args.argv;
}
builtin = get_builtin(cmd);
if (builtin)
exit(run_builtin(builtin, argc, argv));
+ argv_array_clear(&args);
}
static void execv_dashed_external(const char **argv)