GNU bug report logs - #51112
28.0.50; vc-print-log shows empty log

Previous Next

Package: emacs;

Reported by: Michael Albinus <michael.albinus <at> gmx.de>

Date: Sun, 10 Oct 2021 07:47:02 UTC

Severity: normal

Found in version 28.0.50

Done: Stefan Kangas <stefan <at> marxist.se>

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: Michael Albinus <michael.albinus <at> gmx.de>, 51112 <at> debbugs.gnu.org
Cc: ASANO Fumihisa <fasano <at> biglobe.jp>
Subject: bug#51112: 28.0.50; vc-print-log shows empty log
Date: Mon, 11 Oct 2021 02:37:10 +0300
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."




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

Previous Next


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