GNU bug report logs - #39452
[PATCH] vc-git-state fails for filenames with wildcards

Previous Next

Package: emacs;

Reported by: Wolfgang Scherer <Wolfgang.Scherer <at> gmx.de>

Date: Thu, 6 Feb 2020 14:00:02 UTC

Severity: normal

Tags: patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Noam Postavsky <npostavs <at> gmail.com>, 39452 <at> debbugs.gnu.org, Wolfgang.Scherer <at> gmx.de
Subject: bug#39452: [PATCH] vc-git-state fails for filenames with wildcards
Date: Sat, 14 Aug 2021 03:11:56 +0300
On 22.07.2021 15:42, Lars Ingebrigtsen wrote:
> Nobody had any opinions, and the "if it's good enough for Magit"
> argument is a good one.  So I went ahead and applied Dmitry's patch to
> Emacs 28, and we'll see whether there's any push back on that...

As luck would have it, I have a bit of code (namely 
project--vc-list-files) that got broken with that change.

Because, when EXTRA-IGNORES are present, it constructs some non-literal 
pathspecs, which naturally fail (get misinterpreted) with 
GIT_LITERAL_PATHSPECS=1.

So we need an escape hatch to turn off this feature, which could take 
form of a dynamic variable, like in the patch below.

Or we could revert to the other approach. What do people think?


diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 714edeba5f..824ea55e7b 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -523,6 +523,7 @@ project--vc-list-files
     (`Git
      (let ((default-directory (expand-file-name 
(file-name-as-directory dir)))
            (args '("-z"))
+           vc-git-use-literal-pathspecs
            files)
        ;; Include unregistered.
        (setq args (append args
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 143087122f..1082e724ff 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -220,6 +220,9 @@ vc-git-revision-complete-only-branches
   :type 'boolean
   :version "28.1")

+(defvar vc-git-use-literal-pathspecs t
+  "Non-nil to interpret all Git pathspecs literally.")
+
 ;; History of Git commands.
 (defvar vc-git-history nil)

@@ -1772,7 +1775,8 @@ vc-git-command
         (process-environment
          (append
           `("GIT_DIR"
-            "GIT_LITERAL_PATHSPECS=1"
+            ,@(when vc-git-use-literal-pathspecs
+                '("GIT_LITERAL_PATHSPECS=1"))
             ;; Avoid repository locking during background operations
             ;; (bug#21559).
             ,@(when revert-buffer-in-progress-p
@@ -1807,8 +1811,9 @@ vc-git--call
 	(process-environment
 	 (append
 	  `("GIT_DIR"
-            "GIT_LITERAL_PATHSPECS=1"
-	    ;; Avoid repository locking during background operations
+            ,@(when vc-git-use-literal-pathspecs
+                '("GIT_LITERAL_PATHSPECS=1"))
+            ;; Avoid repository locking during background operations
 	    ;; (bug#21559).
 	    ,@(when revert-buffer-in-progress-p
 		'("GIT_OPTIONAL_LOCKS=0")))




This bug report was last modified 3 years and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.