Re: [PATCH v2 3/4] Speed up is_git_command() by checking early for internal commands
- From
Jeff King <peff@peff.net>
- Date
- Jan 3, 2014, 15:44 UTC
- Message-ID
- <20140103154426.GA23534@sigill.intra.peff.net>
- In-Reply-To
- <xmqq38l6qii6.fsf@gitster.dls.corp.google.com>
On Thu, Jan 02, 2014 at 11:41:05AM -0800, Junio C Hamano wrote:
Show 6 quoted lines
> - 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. 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.
-Peff