Re: [PATCH v2 3/4] Speed up is_git_command() by checking early for internal commands
Jeff King <peff@peff.net> writes:
Show 11 quoted lines
> On Thu, Jan 02, 2014 at 11:41:05AM -0800, Junio C Hamano wrote:
>
>> - builtin/merge.c is the same, but it is conceptually even worse.
>> It has the end-user supplied string and wants to see if it is a
>> valid strategy. If the user wants to use a custom strategy, a
>> single stat() to make sure if it exists should suffice, and the
>> error codepath should load the command list to present the names
>> of available ones in the error message.
>
> Is it a single stat()? I think we would need to check each element of
> $PATH.
Yeah, load_command_list() iterates over the members of env_path.
> Though in practice, the exec-dir would be the first thing we
> check, and where we would find the majority of hits. So it would still
> be a win, as we would avoid touching anything but the exec-dir in the
> common case.