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

Re: [PATCH 0/5] New config option for git-grep to include untracked files

From
DSDragan Simic <dsimic@manjaro.org>
Date
Mar 19, 2024, 05:09 UTC
Message-ID
<c68a6d94bb02e5d9aa2f81bee022baa8@manjaro.org>
In-Reply-To
<xmqqwmpzt6jk.fsf@gitster.g>
Hello Junio,
On 2024-03-19 01:21, Junio C Hamano wrote:
Show 19 quoted lines
> Dragan Simic <dsimic@manjaro.org> writes:
> 
>> This patch series introduces new config option grep.includeUntracked,
>> which makes the untracked files also searched by default when 
>> git-grep(1)
>> is invoked, in addition to searching the tracked files.
> 
> Hmph.  I am moderately negative on any configuration that screws
> with the default haystack from which needle is sought for.
> 
> I may often do "git grep --cached" but that does not mean I would
> welcome an configuration option to make "git grep" search in the
> index even when the request by the user does not have "--cached".
> 
> Inclusion of untracked sources in a sense is even worse, especially
> when an unsuspecting "git grep" user (or a script) fully expects
> that any paths found in the output are to be found in "git ls-files
> -s" output but when you stray into a repository with the
> configuration set, that expectation suddelnly gets broken.

Hmm... Those are valid concerns. For example, I'd also be against another configuration option that would make it possible to enable --cached by default, for example, because it could easily mess the things up really bad.

However, I think that the usability of this new configuration option outweighs the possible issues it could cause to some users. For example, I quite often find myself in need to specify --untracked while running git-grep(1), to see what's found in the code changes I haven't staged yet, so I find this new configuration very useful.

Of course, I already have a few aliases defined for grep operations, but defining another one for "grep --untracked" simply doesn't fit into my alias scheme. Obviously, that's why I implemented this new option, :) hoping that it would be usable to other people, too.

I'm not sure how many users could be affected by the possible negative effects of this configuration option, by using a specific mix of git operations, but I think it would be quite useful.

Previous: Junio C HamanoNext: Junio C Hamano
Message 20 of 22 in “New config option for git-grep to include untracked files”
  1. 0/5 New config option for git-grep to include untracked filesDragan Simic, Mar 18, 2024
  2. 3/5 grep docs: describe --no-index furtherDragan Simic, Mar 18, 2024
  3. Junio C HamanoMar 19, 2024
  4. Dragan SimicMar 19, 2024
  5. 4/5 grep: introduce new config option to include untracked filesDragan Simic, Mar 18, 2024
  6. Junio C HamanoMar 19, 2024
  7. Dragan SimicMar 19, 2024
  8. Junio C HamanoMar 19, 2024
  9. Dragan SimicMar 19, 2024
  10. 2/5 grep docs: describe --recurse-submodules further and improve formatting a bitDragan Simic, Mar 18, 2024
  11. Eric SunshineMar 18, 2024
  12. Dragan SimicMar 18, 2024
  13. 1/5 grep: perform some minor code and comment cleanupsDragan Simic, Mar 18, 2024
  14. Eric SunshineMar 18, 2024
  15. Dragan SimicMar 18, 2024
  16. Junio C HamanoMar 19, 2024
  17. Dragan SimicMar 19, 2024
  18. 5/5 grep docs: describe new config option to include untracked filesDragan Simic, Mar 18, 2024
  19. Junio C HamanoMar 19, 2024
  20. Dragan SimicMar 19, 2024
  21. Junio C HamanoMar 19, 2024
  22. Dragan SimicMar 19, 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.