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

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

bug#51112: 28.0.50; vc-print-log shows empty log


From: Dmitry Gutov
Subject: bug#51112: 28.0.50; vc-print-log shows empty log
Date: Mon, 11 Oct 2021 02:37:10 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Hi Michael,

On 10.10.2021 10:46, Michael Albinus wrote:
This has been reported on the Tramp mailing list, see
<https://lists.gnu.org/archive/html/tramp-devel/2021-10/msg00026.html>.

If you run Emacs on MS Windows, and you try to print the git log of a
remote file, you don't get anything. This is because vc-print-log has
emitted the following command:

--8<---------------cut here---------------start------------->8---
git --no-pager log --no-color -n 2000 -- \:\(literal\)c\:/tmp/tramp/README
--8<---------------cut here---------------end--------------->8---

See the leading drive letter "c:" in the file name. The problem is
`vc-git--literal-pathspec', which calls `expand-file-name' on the
*local*  part of the remote file name.

A fix could be

--8<---------------cut here---------------start------------->8---
(defun vc-git--literal-pathspec (file)
   "Prepend :(literal) path magic to FILE."
   ;; Good example of file name that needs this: "test[56].xx".
   (when file
     ;; Expand abbreviated file names.
     (concat ":(literal)" (file-local-name (expand-file-name file)))))
--8<---------------cut here---------------end--------------->8---

Does this patch work for you?

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index eca8d547a9..35c0838dd6 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -242,15 +242,14 @@ vc-git-update-on-retrieve-tag
 ;;;###autoload         (load "vc-git" nil t)
 ;;;###autoload         (vc-git-registered file))))

+;; Good example of file name that needs this: "test[56].xx".
 (defun vc-git--literal-pathspec (file)
   "Prepend :(literal) path magic to FILE."
-  ;; Good example of file name that needs this: "test[56].xx".
   (when file
-    (let ((lname (file-local-name file)))
-      ;; Expand abbreviated file names.
-      (when (file-name-absolute-p lname)
-        (setq lname (expand-file-name lname)))
-      (concat ":(literal)" lname))))
+    ;; Expand abbreviated file names.
+    (when (file-name-absolute-p file)
+      (setq file (expand-file-name file)))
+    (concat ":(literal)" (file-local-name file))))

 (defun vc-git--literal-pathspecs (files)
   "Prepend :(literal) path magic to FILES."





reply via email to

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