unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39452: [PATCH] vc-git-state fails for filenames with wildcards
@ 2020-02-06 13:59 Wolfgang Scherer
  2020-02-06 23:00 ` Dmitry Gutov
  0 siblings, 1 reply; 44+ messages in thread
From: Wolfgang Scherer @ 2020-02-06 13:59 UTC (permalink / raw)
  To: 39452

[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]

When a filename contains shell wildcard characters matching one or more files, e.g. `test[56].xx` matching both `test5.xx` and `test6.xx`:

  -rw-r--r--  1 ws ws    0 Feb  6 08:51 test[56].xx
  -rw-r--r--  1 ws ws    0 Feb  6 08:51 test5.xx
  -rw-r--r--  1 ws ws    0 Feb  6 08:51 test6.xx

The command `vc-git-state` does not work correctly.

The attched patch fixes this:

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 2caa287..0314e5e 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -330,7 +330,7 @@ in the order given by `git status'."
             ,@(when (version<= "1.7.6.3" (vc-git--program-version))
                 '("--ignored"))
             "--"))
-        (status (apply #'vc-git--run-command-string file args)))
+        (status (apply #'vc-git--run-command-string (shell-quote-argument file) args)))
     (if (null status)
         ;; If status is nil, there was an error calling git, likely because
         ;; the file is not in a git repo.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-vc-git-state-fails-for-filenames-with-wildcards.patch --]
[-- Type: text/x-patch; name="0001-vc-git-state-fails-for-filenames-with-wildcards.patch", Size: 1047 bytes --]

From d123319e15d5ff24d3353f0d5c1b5f46c22172e2 Mon Sep 17 00:00:00 2001
From: Wolfgang Scherer <wolfgang.scherer@gmx.de>
Date: Thu, 6 Feb 2020 14:41:12 +0100
Subject: [PATCH] vc-git-state fails for filenames with wildcards

* lisp/vc/vc-git.el (vc-git-state): file argument must be quoted to
avoid wildcard expansion by shell.
---
 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 2caa287..0314e5e 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -330,7 +330,7 @@ in the order given by `git status'."
             ,@(when (version<= "1.7.6.3" (vc-git--program-version))
                 '("--ignored"))
             "--"))
-        (status (apply #'vc-git--run-command-string file args)))
+        (status (apply #'vc-git--run-command-string (shell-quote-argument file) args)))
     (if (null status)
         ;; If status is nil, there was an error calling git, likely because
         ;; the file is not in a git repo.
--
2.7.4


^ permalink raw reply related	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2021-08-30 23:48 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-06 13:59 bug#39452: [PATCH] vc-git-state fails for filenames with wildcards Wolfgang Scherer
2020-02-06 23:00 ` Dmitry Gutov
2020-02-07  7:57   ` Eli Zaretskii
2020-02-07  8:43     ` Dmitry Gutov
2020-02-07  9:26       ` Eli Zaretskii
2020-02-07 11:43         ` Dmitry Gutov
2020-02-07 14:43       ` Noam Postavsky
2020-02-11 23:01         ` Dmitry Gutov
2020-02-12 15:24           ` Noam Postavsky
2021-05-12 16:04             ` Lars Ingebrigtsen
2021-05-17  1:05               ` Dmitry Gutov
2021-07-22 12:42                 ` Lars Ingebrigtsen
2021-08-14  0:11                   ` Dmitry Gutov
2021-08-14 11:56                     ` Lars Ingebrigtsen
2021-08-15  1:25                       ` Dmitry Gutov
2021-08-27  6:05                         ` Juri Linkov
2021-08-27 12:51                           ` Dmitry Gutov
2021-08-27 17:10                             ` Juri Linkov
2021-08-27 19:57                               ` Stephen Berman
2021-08-28 15:07                                 ` Lars Ingebrigtsen
2021-08-28 15:44                                   ` Stephen Berman
2021-08-28 15:48                                     ` Lars Ingebrigtsen
2021-08-28 16:02                                       ` Stephen Berman
2021-08-28 22:19                                       ` Dmitry Gutov
2021-08-30  2:36                                 ` Dmitry Gutov
2021-08-30 13:34                                   ` Stephen Berman
2021-08-30 23:48                                     ` Dmitry Gutov
2021-08-27 22:47                               ` Dmitry Gutov
2021-08-29  0:18                             ` Dmitry Gutov
2021-08-29 16:44                               ` Juri Linkov
2021-08-29 19:50                                 ` Dmitry Gutov
2021-08-29 19:57                                   ` Lars Ingebrigtsen
2021-08-29 20:11                                     ` Dmitry Gutov
2020-02-13 18:34           ` Wolfgang Scherer
2020-02-13 23:23             ` Dmitry Gutov
2020-02-14  9:37               ` Eli Zaretskii
2020-02-14 13:59                 ` Dmitry Gutov
2020-02-14 14:14                   ` Eli Zaretskii
2020-02-14 14:40                     ` Dmitry Gutov
2020-02-14 15:45                       ` Eli Zaretskii
2020-02-14 20:37                         ` Dmitry Gutov
2020-09-20  9:54               ` Lars Ingebrigtsen
2020-02-07 17:25   ` Wolfgang Scherer
2020-02-07 22:31     ` Wolfgang Scherer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).