Subject: bug#29303: 25.2; vc-git-grep should shell-escape FILES

From: Eli Zaretskii <[email-masked]>
Date: Wed, 15 Nov 2017 21:58:49 +0200

> From: Robert Pluim <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Wed, 15 Nov 2017 19:45:52 +0100
> 
> > This cannot be right, because this style of quoting only works with
> > Posix shells.
> 
> There are people who run Emacs on Windows who use cmd.exe as the shell
> to invoke git?

Yes, most of them, because that's the default.  But that's not
relevant, because shell wildcards are expanded on Windows by the
startup code of the invoked program, not by the shell.

> diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
> index ed85603f82..43164b4fcf 100644
> --- a/lisp/vc/vc-git.el
> +++ b/lisp/vc/vc-git.el
> @@ -1428,7 +1428,7 @@ vc-git-grep
>  				   nil nil 'grep-history)
>  	     nil))
>        (t (let* ((regexp (grep-read-regexp))
> -		(files (grep-read-files regexp))
> +		(files (mapconcat #'shell-quote-argument (split-string (grep-read-files regexp)) " "))
>  		(dir (read-directory-name "In directory: "
>  					  nil default-directory t)))
>  	   (list regexp files dir))))))

That's okay portability-wise, but why do you need split-string?
AFAIU, grep-read-files reads a single pattern, no?