Re: [PATCH v2 6/6] exclude: filter patterns by directory level
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Mar 10, 2013, 10:18 UTC
- Message-ID
- <CACsJy8DwfYL80Zwxufv7Uz7-H_c8VTs=DNQkeDz2bh4K1tTtcw@mail.gmail.com>
- In-Reply-To
- <7vtxojd5u7.fsf@alter.siamese.dyndns.org>
On Sun, Mar 10, 2013 at 3:20 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 5 quoted lines
>> + 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 number of prep_exclude calls significantly by only calling it when we switch directories (i.e. when read_directory_recursive begins or exits), not calling it for all entries of the same directory. For instance, path/, path/a, path/b, path/c/, path/c/d, path/e should only call prep_exclude 3 times when we enter "path", "path/c" and leave "path/c" (rather than 6 times currently). Unfortunately, I see no real time savings by this call reduction. So no patch. Maybe I'll try it again on my slower laptop and see if it makes any difference.
-- Duy