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: Noam Postavsky <npostavs <at> gmail.com>
Cc: 39452 <at> debbugs.gnu.org, Wolfgang.Scherer <at> gmx.de
Subject: bug#39452: [PATCH] vc-git-state fails for filenames with wildcards
Date: Wed, 12 Feb 2020 01:01:20 +0200
On 07.02.2020 16:43, Noam Postavsky wrote:
> Dmitry Gutov <dgutov <at> yandex.ru> writes:
> 
>> It's not so simple. FILE already goes through call-process. But Git
>> expects a pathspec, not just a file name. So if it's a glob, it is
>> expanded.
> 
> You can pass --literal-pathspecs to tell git not to expand.  Magit does
> this.  But there is a downside due to the way git implements it, which
> is by setting an environment variable: it affects all subprocesses git
> calls, including git-hook scripts which tends to trip people up.

I wonder how bad the latter problem is. After all, even if it happens, 
it *can* be worked around in the same scripts.

The patch is much smaller than the proposed alternative:

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 61e6c642d1..bbfdbfbe52 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1751,6 +1751,7 @@ vc-git-command
         (process-environment
          (append
           `("GIT_DIR"
+            "GIT_LITERAL_PATHSPECS=1"
             ;; Avoid repository locking during background operations
             ;; (bug#21559).
             ,@(when revert-buffer-in-progress-p
@@ -1785,6 +1786,7 @@ vc-git--call
 	(process-environment
 	 (append
 	  `("GIT_DIR"
+            "GIT_LITERAL_PATHSPECS=1"
 	    ;; Avoid repository locking during background operations
 	    ;; (bug#21559).
 	    ,@(when revert-buffer-in-progress-p

And if Magit does it, it's probably okay for most of VC users too.




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.