grep and rg always walk, filter, order and label the files themselves. A
mount’s search only tells them which files and lines they can skip, so the
output is byte for byte what a full scan prints.
What a mount answers
Box and Dropbox answer
files_containing for whole words when the mount sets
content_search: true. Postgres, MongoDB and Langfuse answer a single-operand
grep or rg with their own query and fall back to the walk above. GitHub,
Slack, Discord, Gmail and email run their own grep and rg. Any VFS can answer
the three methods: see Python and
TypeScript.
Flags
Every other flag (
-l, -c, -q, -h, -m, --include, --exclude,
-g, -t, …) is applied by the walk as usual.
Always read
A file named on the command line, a binary-extension file under-a, and any
path under a hide, a path rule or a pre_vfs policy, where the search is not
asked at all.
Refusing a scan
When nothing can narrow,before_full_scan is called once, before the first
file read in full, with why:
Raise from it to refuse: the command prints
grep: <message> and exits 1.
A filesystem error raised at a file, after lines_containing declined it, is
that file’s read error instead: each such file reports it and grep exits 2.