git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 25, 2024, 19:18 UTC
Message-ID
<xmqqa5mmjf2f.fsf@gitster.g>
In-Reply-To
<a7e5151fa615d572ab4ed05519dd277048ce935c.1711302588.git.dsimic@manjaro.org>
Dragan Simic <dsimic@manjaro.org> writes:
Show 6 quoted lines
> +--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.
Show 6 quoted lines
>  --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.
Previous: Dragan SimicNext: Dragan Simic
Message 10 of 11 in “Assorted improvements salvaged from an earlier series”
  1. 0/3 Assorted improvements salvaged from an earlier seriesDragan Simic, Mar 24, 2024
  2. 1/3 grep: perform some minor code and comment cleanupsDragan Simic, Mar 24, 2024
  3. Junio C HamanoMar 25, 2024
  4. Dragan SimicMar 25, 2024
  5. Junio C HamanoMar 25, 2024
  6. 2/3 grep docs: describe --recurse-submodules further and improve formatting a bitDragan Simic, Mar 24, 2024
  7. Junio C HamanoMar 25, 2024
  8. Dragan SimicMar 25, 2024
  9. 3/3 grep docs: describe --no-index further and improve formatting a bitDragan Simic, Mar 24, 2024
  10. Junio C HamanoMar 25, 2024
  11. Dragan SimicMar 25, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.