diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2012-11-24 08:33:51 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-11-26 23:16:34 +0400 |
commit | c904cd89e4328c0b5041b6ee0bb2df32459a33a2 (patch) | |
tree | 7ffe77166543e60ce97327090b3907ef820c3c19 /delta.h | |
parent | 8c6abbcd2720dd80b1c9b6db8104c4dcc7cba6c7 (diff) |
tree_entry_interesting: do basedir compare on wildcard patterns when possible
Currently we treat "*.c" and "path/to/*.c" the same way. Which means
we check all possible paths in repo against "path/to/*.c". One could
see that "path/elsewhere/foo.c" obviously cannot match "path/to/*.c"
and we only need to check all paths _inside_ "path/to/" against that
pattern.
This patch checks the leading fixed part of a pathspec against base
directory and exit early if possible. We could even optimize further
in "path/to/something*.c" case (i.e. check the fixed part against
name_entry as well) but that's more complicated and probably does not
gain us much.
-O2 build on linux-2.6, without and with this patch respectively:
$ time git rev-list --quiet HEAD -- 'drivers/*.c'
real 1m9.484s
user 1m9.128s
sys 0m0.181s
$ time ~/w/git/git rev-list --quiet HEAD -- 'drivers/*.c'
real 0m15.710s
user 0m15.564s
sys 0m0.107s
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'delta.h')
0 files changed, 0 insertions, 0 deletions