From df5614297b6d4ca8a3c9cd18fea5088401b25146 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 4 Dec 2018 02:15:37 +0200 Subject: [PATCH] * lisp/vc/vc-git.el (vc-git-stash): Call vc-dir-marked-files only in vc-dir-mode. --- lisp/vc/vc-git.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index e406660d2fd..f3174005307 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1475,12 +1475,16 @@ This command shares argument histories with \\[rgrep] and \\[grep]." (if (eq next-error-last-buffer (current-buffer)) (setq default-directory dir)))))) +(autoload 'vc-dir-marked-files "vc-dir") + (defun vc-git-stash (name) "Create a stash." (interactive "sStash name: ") (let ((root (vc-git-root default-directory))) (when root - (apply #'vc-git--call nil "stash" "push" "-m" name (vc-dir-marked-files)) + (apply #'vc-git--call nil "stash" "push" "-m" name + (when (derived-mode-p 'vc-dir-mode) + (vc-dir-marked-files))) (vc-resynch-buffer root t t)))) (defvar vc-git-stash-read-history nil -- 2.39.5