Function: magit-stash-save
magit-stash-save is a byte-compiled function defined in
magit-stash.el.
Signature
(magit-stash-save MESSAGE INDEX WORKTREE UNTRACKED &optional REFRESH KEEP NOERROR REF)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-stash.el
;;; Plumbing
(defun magit-stash-save (message index worktree untracked
&optional refresh keep noerror ref)
(if (or (and index (magit-staged-files t))
(and worktree (magit-unstaged-files t))
(and untracked (magit-untracked-files (eq untracked 'all))))
(magit-with-toplevel
(magit-stash-store message (or ref "refs/stash")
(magit-stash-create message index worktree untracked))
(if (eq keep 'worktree)
(with-temp-buffer
(magit-git-insert "diff" "--cached" "--no-ext-diff")
(magit-run-git-with-input
"apply" "--reverse" "--cached" "--ignore-space-change" "-")
(magit-run-git-with-input
"apply" "--reverse" "--ignore-space-change" "-"))
(unless (eq keep t)
(if (eq keep 'index)
(magit-call-git "checkout" "--" ".")
(magit-call-git "reset" "--hard" "HEAD" "--"))
(when untracked
(magit-call-git "clean" "--force" "-d"
(and (eq untracked 'all) "-x")))))
(when refresh
(magit-refresh)))
(unless noerror
(user-error "No %s changes to save" (cond ((not index) "unstaged")
((not worktree) "staged")
("local"))))))