bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Robert Pluim
Subject: bug#29303: 25.2; vc-git-grep should shell-escape FILES
Date: Wed, 15 Nov 2017 19:45:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> 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? Takes all sorts, I guess. How about this then?

>From 0e3b4ee74bebae702bade0f1715fbb96b46bbec6 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
Date: Wed, 15 Nov 2017 10:51:37 +0100
Subject: [PATCH] Shell quote filenames to inhibit globbing by the shell

* lisp/vc/vc-git.el (vc-git-grep): Apply shell quoting to filename
patterns to ensure globbing is done by git rather than the
shell. (Bug#29303)
---
 lisp/vc/vc-git.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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))))))
-- 
2.15.0.276.g89ea799ff


reply via email to

[Prev in Thread] Current Thread [Next in Thread]