Re: [PATCH v2 6/6] exclude: filter patterns by directory level

2013-03-10 Thread Duy Nguyen
On Sun, Mar 10, 2013 at 5:58 PM, Junio C Hamano wrote: > Junio C Hamano writes: > >> Nguyễn Thái Ngọc Duy writes: >> >>> A non-basename pattern that does not contain /**/ can't match anything >>> outside the attached directory. Record its directory level and avoid >>> matching unless the pathna

Re: [PATCH v2 6/6] exclude: filter patterns by directory level

2013-03-10 Thread Junio C Hamano
Junio C Hamano writes: > Nguyễn Thái Ngọc Duy writes: > >> A non-basename pattern that does not contain /**/ can't match anything >> outside the attached directory. Record its directory level and avoid >> matching unless the pathname is also at the same directory level. > > Without defining wha

Re: [PATCH v2 6/6] exclude: filter patterns by directory level

2013-03-10 Thread Duy Nguyen
On Sun, Mar 10, 2013 at 3:20 PM, Junio C Hamano wrote: >> + else if (*p == '/') >> + dirs--; > > I presume this is to compensate for a pattern like "/pat" whose > leading slash is only to anchor the pattern at the level. Correct? Yes. Also for the record, we could cut down the n

Re: [PATCH v2 6/6] exclude: filter patterns by directory level

2013-03-10 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > A non-basename pattern that does not contain /**/ can't match anything > outside the attached directory. Record its directory level and avoid > matching unless the pathname is also at the same directory level. Without defining what a "directory level" is, the abov

[PATCH v2 6/6] exclude: filter patterns by directory level

2013-03-09 Thread Nguyễn Thái Ngọc Duy
A non-basename pattern that does not contain /**/ can't match anything outside the attached directory. Record its directory level and avoid matching unless the pathname is also at the same directory level. This optimization shines when there are a lot of non-basename patterns are the root .gitigno