Subject: bug#19944: 25.0.50; vc-git-grep doesn't use grep-read-files correctly

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 03 Dec 2020 12:50:14 +0100

Rupert Swarbrick <[email-masked]> writes:

> The vc-git-grep function uses grep-read-files to figure out the list of
> files to check. This gets glued to the end of the git grep command
> line. With the default value of grep-files-aliases, if the user enters
> "all" for their files, grep-read-files returns the string "* .*".
>
> If you do the following:
>
>    cd /path/to/my/git/repo
>    git grep foo -- * .*
>
> then you get something like:
>
>   /path/to/my/git/repo> git grep foo -- * .*
>   fatal: ..: '..' is outside repository
>
> because .* expands to a list including "..".

(This bug report unfortunately got no response at the time.)

Looks like this has been fixed in more recent versions of Emacs.  Trying
this, I get:

git --no-pager grep -n --color -i -e emacs -- \* .\[\!.\]\* ..\?\*

and everything works are it should, I think.

> We're also doing the wrong thing when the user gives a pattern. For
> example, if I go into the top-level Emacs directory and run
>
>   M-x vc-git-grep
>
> enter vc-git-grep as the string to search for and enter *g* for the
> files to search, then I get:
>
>   Grep started at Wed Feb 25 11:17:28
>
>   git --no-pager grep -n -e vc-git-grep -- *g*

This, too -- I get:

git --no-pager grep -n --color -i -e emacs -- \*g\*

So I'm guessing this has been fixed, and I'm closing this bug report.
If there's still a problem here, please respond to the debbugs address,
and we'll reopen the bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no