]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't have vc-git-stash-list bug out on the .git directory
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 20 Sep 2020 10:12:36 +0000 (12:12 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 20 Sep 2020 10:12:41 +0000 (12:12 +0200)
* lisp/vc/vc-git.el (vc-git-stash-list): Don't bug out when
running on the .git directory itself (bug#39285).

lisp/vc/vc-git.el

index 84aeb0a11053527f2cc0939a710987901a7eb9d8..6ff6951dbc989bd96274064c28835c26a6fe53b7 100644 (file)
@@ -1707,12 +1707,13 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
   (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")))
+  (when-let ((out (vc-git--run-command-string nil "stash" "list")))
+    (delete
+     ""
+     (split-string
+      (replace-regexp-in-string
+       "^stash@" "             " out)
+      "\n"))))
 
 (defun vc-git-stash-get-at-point (point)
   (save-excursion