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

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

bug#39452: [PATCH] vc-git-state fails for filenames with wildcards


From: Dmitry Gutov
Subject: bug#39452: [PATCH] vc-git-state fails for filenames with wildcards
Date: Wed, 12 Feb 2020 01:01:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 07.02.2020 16:43, Noam Postavsky wrote:
Dmitry Gutov <address@hidden> 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.





reply via email to

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