Function: magit-stash--apply-1
magit-stash--apply-1 is a byte-compiled function defined in
magit-stash.el.
Signature
(magit-stash--apply-1 ACTION STASH)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-stash.el
(defun magit-stash--apply-1 (action stash)
(or
(magit--run-git-stash action "--index" stash)
;; The stash's index could not be applied, so always keep the stash.
(magit--run-git-stash "apply" stash)
(let* ((range (format "%s^..%s" stash stash))
(stashed (magit-git-items "diff" "-z" "--name-only" range "--"))
(conflicts (cl-sort (cl-union (magit-unstaged-files t stashed)
(magit-untracked-files t stashed)
:test #'equal)
#'string<))
(arg (if (or (not conflicts)
(memq 'stash-apply-3way magit-no-confirm))
"--3way"
(magit-read-char-case
(concat
"Could not apply stash because of unstaged changes.\n\n"
"To do a tree-way merge, these files have to be staged\n"
(mapconcat (##format " %s" %) conflicts "\n")
"\n")
nil
(?s (format
"\n[s] stage file%s and apply with \"git apply --3way\""
(if (length> conflicts 1) "s" ""))
"--3way")
(?r "\n[r] apply with \"git apply --reject\"" "--reject")
(?c "\n[c] cancel" nil)))))
(when arg
(when (and (equal arg "--3way") conflicts)
(magit-stage-1 nil conflicts))
(with-temp-buffer
(magit-git-insert "diff" range)
(magit-run-git-with-input "apply" arg "-"))))))