[Top][All Lists]

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

bug#39285: 28.0.50; vc-dir on gitdir results in error

From: Dmitry Gutov
Subject: bug#39285: 28.0.50; vc-dir on gitdir results in error
Date: Mon, 27 Jan 2020 08:49:20 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Hi there!

On 26.01.2020 0:55, Mark A. Hershberger wrote:

While trying projectile's "Browse dirty projects", I hit an error.  I
was able to reproduce this error using

     (vc-dir "/home/mah/work/code/emacs/.git/")

or any other git dir.

What kind of directory is this?

Normally, .git is a utility directory which is not considered part of the work tree. So most git commands fail inside it.

I suppose vc-git-stash-list could handle this better, but you still won't get anything better than a misleadingly empty VC-Dir buffer. The current behavior might even be better in that regard.

This patch would make it shut up, though:

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 61e6c642d1..9b3f3c6545 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1688,12 +1688,14 @@ vc-git-stash-snapshot
   (vc-resynch-buffer (vc-git-root default-directory) t t))

 (defun vc-git-stash-list ()
-  (delete
-   ""
-   (split-string
-    (replace-regexp-in-string
- "^stash@" " " (vc-git--run-command-string nil "stash" "list"))
-    "\n")))
+  (let ((out (vc-git--run-command-string nil "stash" "list")))
+    (when out
+      (delete
+       ""
+       (split-string
+        (replace-regexp-in-string
+         "^stash@" "             " out)
+        "\n")))))

 (defun vc-git-stash-get-at-point (point)

reply via email to

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