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>
This commit is contained in:
committed by
Junio C Hamano
parent
a3c5263438
commit
c6127fa3e2
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user