Re: [PATCH 2/3] exclude: do strcmp as much as possible before fnmatch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 29, 2012, 18:03 UTC
- Message-ID
- <7v8vga6f1a.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1338035474-4346-3-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 18 quoted lines
> this also avoids calling fnmatch() if the non-wildcard prefix is
> longer than basename
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> dir.c | 41 +++++++++++++++++++++++++++--------------
> dir.h | 2 +-
> 2 files changed, 28 insertions(+), 15 deletions(-)
>
> diff --git a/dir.c b/dir.c
> index 8535cf2..50d744f 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -295,9 +295,11 @@ int match_pathspec_depth(const struct pathspec *ps,
> return retval;
> }
>
> +const char *wildcards = "*?[{\\";Elsewhere in this file, the logic to notice the non-wildcard part of the pathspec uses is_glob_special(). Shouldn't the new code that use this do the same?