From: Sebastian Schuberth <sschuberth@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
Christian Couder <christian.couder@gmail.com>
Subject: [PATCH v2 2/4] Call load_command_list() only when it is needed
Date: Thu, 02 Jan 2014 17:16:30 +0100 [thread overview]
Message-ID: <52C590DE.6030305@gmail.com> (raw)
In-Reply-To: <52C58FD7.6010608@gmail.com>
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>
---
builtin/help.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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);
}
--
1.8.3-mingw-1
next prev parent reply other threads:[~2014-01-02 16:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 16:12 [PATCH v2 0/4] Sebastian Schuberth
2014-01-02 16:15 ` [PATCH v2 1/4] Consistently use the term "builtin" instead of "internal command" Sebastian Schuberth
2014-01-02 20:31 ` Jonathan Nieder
2014-01-02 21:05 ` Sebastian Schuberth
2014-01-22 21:08 ` Sebastian Schuberth
2014-01-02 16:16 ` Sebastian Schuberth [this message]
2014-01-02 16:17 ` [PATCH v2 3/4] Speed up is_git_command() by checking early for internal commands Sebastian Schuberth
2014-01-02 19:41 ` Junio C Hamano
2014-01-03 15:44 ` Jeff King
2014-01-03 18:00 ` Junio C Hamano
2014-01-03 16:49 ` Kent R. Spillner
2014-01-05 13:42 ` Sebastian Schuberth
2014-01-22 21:05 ` Sebastian Schuberth
2014-01-02 16:17 ` [PATCH v2 4/4] Move builtin-related implementations to a new builtin.c file Sebastian Schuberth
2014-01-02 19:43 ` Junio C Hamano
2014-01-02 20:58 ` Sebastian Schuberth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52C590DE.6030305@gmail.com \
--to=sschuberth@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.