emacs-diffs
[Top][All Lists]
Advanced

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

master 108dbed: Re-fix bug#16897


From: Dmitry Gutov
Subject: master 108dbed: Re-fix bug#16897
Date: Sat, 11 Sep 2021 20:30:55 -0400 (EDT)

branch: master
commit 108dbed4c0d874f71bc40f63d39d8777ce192303
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Re-fix bug#16897
    
    * lisp/vc/vc-git.el (vc-git--file-list-is-rootdir):
    Extract from 'vc-git-command'.
    (vc-git--literal-pathspecs): Use it here as well.
---
 lisp/vc/vc-git.el | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 5835b5b..4b309c3 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -254,7 +254,8 @@ included in the completions."
 
 (defun vc-git--literal-pathspecs (files)
   "Prepend :(literal) path magic to FILES."
-  (mapcar #'vc-git--literal-pathspec files))
+  (unless (vc-git--file-list-is-rootdir files)
+    (mapcar #'vc-git--literal-pathspec files)))
 
 (defun vc-git-registered (file)
   "Check whether FILE is registered with git."
@@ -1792,15 +1793,18 @@ The difference to vc-do-command is that this function 
always invokes
                 '("GIT_OPTIONAL_LOCKS=0")))
           process-environment)))
     (apply #'vc-do-command (or buffer "*vc*") okstatus vc-git-program
-          ;; https://debbugs.gnu.org/16897
-          (unless (and (not (cdr-safe file-or-list))
-                       (let ((file (or (car-safe file-or-list)
-                                       file-or-list)))
-                         (and file
-                              (eq ?/ (aref file (1- (length file))))
-                              (equal file (vc-git-root file)))))
-            file-or-list)
-          (cons "--no-pager" flags))))
+           ;; https://debbugs.gnu.org/16897
+           (unless (vc-git--file-list-is-rootdir file-or-list)
+             file-or-list)
+           (cons "--no-pager" flags))))
+
+(defun vc-git--file-list-is-rootdir (file-or-list)
+  (and (not (cdr-safe file-or-list))
+       (let ((file (or (car-safe file-or-list)
+                       file-or-list)))
+         (and file
+              (eq ?/ (aref file (1- (length file))))
+              (equal file (vc-git-root file))))))
 
 (defun vc-git--empty-db-p ()
   "Check if the git db is empty (no commit done yet)."



reply via email to

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