Re: [PATCH 2/3] exclude: do strcmp as much as possible before fnmatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:

> 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@xxxxxxxxx>
> ---

I have been wondering if you can take a different approach based on the
same observation this patch is based on.  If you see an entry /foo/bar/*.c
in the top-level .gitignore, perhaps you can set it aside in a different
part of "struct exclude" for the top-level directory (because the pattern
will never match outside foo/bar directory), so that it is not even used
for matching, and only when you descend to foo/bar directory, add "/*.c"
to the "struct exclude" you create for that directory.

That way, instead of "strcmp is faster than fnmatch, but we always compare
all elements in the huge pattern list given at the toplevel", you would be
doing "we do not even bother to compare with the elements we know do not
matter", which would be far more efficient, no?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]