Subject: Re: bug#61038: 30.0.50; `project-query-replace-regexp' also attempts search and replace in auto-save files

From: Dmitry Gutov <[email-masked]>
Date: Thu, 26 Jan 2023 01:43:20 +0200

On 25/01/2023 22:34, Mickey Petersen wrote:

> (Actually this issue also afflicts auto-save files in my Emacs.)
> 
> And the files in question are not committed to the index, nor are they
> part of the git tree. So they're just stray files that happen to be
> important (backup, auto save) to Emacs.
> 
> It seems odd that you'd want to search and replace those by default,
> particularly when Emacs is well aware of the fact that they are indeed
> backups or auto saves of other files used by that instance of Emacs.

I'm asking why they are not in your .gitignore already. They must get in 
the way of operations such as 'git status', or 'git add *', or 'git 
commit -a', or just in the way of shell completion for 'git add ...'.

> And yes indeed: why not make the project replace mechanism ignore dumb
> things no one wants to edit.

The "project replace mechanism" uses the same set of files that you get 
in completion for project-find-file. Or search through with 
'project-find-regex'.

So far the semantics of the vc-aware backend has been that all files 
that Git doesn't consider ignored (tracked or untracked) are considered 
to be part of the project.

> And committing large, binary files to a tree is common in a wide range
> of situations, though less so in Git, as it's terrible at it.

That's why people usually put the binary files, backup files, etc, in 
.gitignore.

> So, yes, `grep-find-ignored-files' (or a project.el equivalent) should
> indeed exist.

grep-find-ignored-files is a real user option already. You can also use 
project-vc-ignores, but it's nil by default.

A couple of reasons not to use grep-find-ignored-files patterns by default:

- Some users might be actually looking for one of those files, and would 
get surprised that while the Git repository lists them fine (perhaps 
they even checked in such file; maybe they're using unusual file naming 
schemes), but our project backend does not.

- Every addition to the ignored patterns is a minor but steady 
performance hit. grep-find-ignored-files has 61 element by default. 
Dropping all of those into project--vc-list-files can create a 
performance hit of an order of a magnitude. E.g. in my testing the time 
to list the files in gecko-dev went up from 1s to about 5s.