Subject: Re: [PATCH v2 3/3] grep docs: describe --no-index further and improve formatting a bit

From: Junio C Hamano <[email-masked]>
Date: Mon, 25 Mar 2024 12:18:16 -0700

Dragan Simic <[email-masked]> writes:

> +--no-index::
> +	Search files in the current directory that is not managed by Git,
> +	or by ignoring that the current directory is managed by Git.  This
> +	is rather similar to running the regular `grep(1)` utility with its
> +	`-r` option specified, but with some additional benefits, such as
> +	using multiple worker threads to speed up searches.

Sorry for not mentioning this earlier, but I do not think
multi-threaded grep has to be something we own and others cannot
implement.  A richer pathspec globbing [*1*] and logical operation
on match results may be better examples of "additional benefits" if
we really wanted to mention why people might want to use
"--no-index" in a directory that is outside Git.

[Footnote]

 *1* When you want to look for something in files whose name begins
     with "g" but does not have "rc" in it, you'd do

     $ git grep --no-index -c . ':(exclude)*rc*' 'g*'

> ++
> +This option cannot be used together with `--cached` or `--untracked`.
> +See also `grep.fallbackToNoIndex` in 'CONFIGURATION' below.
> +

OK.

>  --threads <num>::
> -	Number of grep worker threads to use.
> -	See `grep.threads` in 'CONFIGURATION' for more information.
> +	Number of `grep` worker threads to use, to speed up searches.
> +	See 'NOTES ON THREADS' and `grep.threads` in 'CONFIGURATION'
> +	for more information.

I actually do not think adding ", to speed up searches" is an
improvement.  But referring to NOTES ON THREADS is a good idea, and
by reading that NOTES ON THREADS section, readers can tell why it
sometimes does not speed things up or even slow them down.

Other than that, looking great.

Thanks.