summaryrefslogtreecommitdiff
path: root/builtin/help.c
diff options
context:
space:
mode:
authorSebastian Schuberth <sschuberth@gmail.com>2014-01-02 16:16:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-01-06 19:26:10 (GMT)
commita3c5263438f7c0ff7dd4d0d8ea86ed7a84a32d18 (patch)
treed1cef2b09296e1ce5e20cf0b1359626435741e2c /builtin/help.c
parent3f784a4dcbe270a1f48b23177917a1832a777d1c (diff)
downloadgit-a3c5263438f7c0ff7dd4d0d8ea86ed7a84a32d18.zip
git-a3c5263438f7c0ff7dd4d0d8ea86ed7a84a32d18.tar.gz
git-a3c5263438f7c0ff7dd4d0d8ea86ed7a84a32d18.tar.bz2
builtin/help.c: call load_command_list() only when it is needed
This avoids list_commands_in_dir() being called when not needed which is quite slow due to file I/O in order to list matching files in a directory. Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/help.c')
-rw-r--r--builtin/help.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/help.c b/builtin/help.c
index cc17e67..b6fc15e 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -288,6 +288,7 @@ static struct cmdnames main_cmds, other_cmds;
static int is_git_command(const char *s)
{
+ load_command_list("git-", &main_cmds, &other_cmds);
return is_in_cmdlist(&main_cmds, s) ||
is_in_cmdlist(&other_cmds, s);
}
@@ -449,7 +450,6 @@ int cmd_help(int argc, const char **argv, const char *prefix)
int nongit;
const char *alias;
enum help_format parsed_help_format;
- load_command_list("git-", &main_cmds, &other_cmds);
argc = parse_options(argc, argv, prefix, builtin_help_options,
builtin_help_usage, 0);
@@ -458,6 +458,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
if (show_all) {
git_config(git_help_config, NULL);
printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
+ load_command_list("git-", &main_cmds, &other_cmds);
list_commands(colopts, &main_cmds, &other_cmds);
}