Subject: Re: [PATCH 2/2] bloom: enable multiple pathspec bloom keys

From: Junio C Hamano <[email-masked]>
Date: Tue, 01 Jul 2025 08:19:27 -0700

Lidong Yan <[email-masked]> writes:

> Junio C Hamano <[email-masked]> writes:
>> Totally outside the topic, but I wonder if we can further optimize
>> by adding an early rejection using .nowildcard_len?  Instead of
>> allowing a wildcarded "dir/*" pathspec element from disabling the
>> Bloom filter altogether, we could say "dir/ is not possibly altered,
>> so there may be dir/A, dir/B, etc., in the directory, nothing that
>> would match dir/* wildcard would have been modified", couldn't we?
>
> I think, except for PATHSPEC_EXCLUDE, all other pathspec magic flags
> could potentially be optimized using .nowildcard_len by restricting checks to
> just the dir/ part of each pathspec item.

A good observation.

I do not know about icase; though.  Asking about "Dir/Path" and
getting "Dir/ or Dir/Path cannot possibly be in the set of paths
that were modified" from the changed-path Bloom filter would not
help us optimize the tree comparison out, when we do not want to
miss modifications for "dir/path".

> Here;s are all possible pathspec magic
> #define PATHSPEC_FROMTOP	(1<<0)
> #define PATHSPEC_MAXDEPTH	(1<<1)
> #define PATHSPEC_LITERAL	(1<<2)
> #define PATHSPEC_GLOB		(1<<3)
> #define PATHSPEC_ICASE		(1<<4)
> #define PATHSPEC_EXCLUDE	(1<<5)
> #define PATHSPEC_ATTR		(1<<6)