From: Juri Linkov Date: Tue, 4 Dec 2018 00:15:37 +0000 (+0200) Subject: * lisp/vc/vc-git.el (vc-git-stash): Call vc-dir-marked-files only X-Git-Tag: emacs-27.0.90~4055 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=df5614297b6d4ca8a3c9cd18fea5088401b25146;p=emacs.git * lisp/vc/vc-git.el (vc-git-stash): Call vc-dir-marked-files only in vc-dir-mode. --- 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