summaryrefslogtreecommitdiff
path: root/builtin/help.c
diff options
context:
space:
mode:
authorSebastian Schuberth <sschuberth@gmail.com>2014-01-02 16:17:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-01-06 19:26:31 (GMT)
commitc6127fa3e25551e969d775b0332d37dc84db1969 (patch)
tree7c154b0d3fc8e7a4bd9a19b8cc185297b68b3972 /builtin/help.c
parenta3c5263438f7c0ff7dd4d0d8ea86ed7a84a32d18 (diff)
downloadgit-c6127fa3e25551e969d775b0332d37dc84db1969.zip
git-c6127fa3e25551e969d775b0332d37dc84db1969.tar.gz
git-c6127fa3e25551e969d775b0332d37dc84db1969.tar.bz2
builtin/help.c: speed up is_git_command() by checking for builtin commands first
Since 2dce956 is_git_command() is a bit slow as it does file I/O in the call to list_commands_in_dir(). Avoid the file I/O by adding an early check for the builtin commands. 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, 3 insertions, 0 deletions
diff --git a/builtin/help.c b/builtin/help.c
index b6fc15e..1fdefeb 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -288,6 +288,9 @@ static struct cmdnames main_cmds, other_cmds;
static int is_git_command(const char *s)
{
+ if (is_builtin(s))
+ return 1;
+
load_command_list("git-", &main_cmds, &other_cmds);
return is_in_cmdlist(&main_cmds, s) ||
is_in_cmdlist(&other_cmds, s);