Function: magit-read-stash

magit-read-stash is a byte-compiled function defined in magit-git.el.

Signature

(magit-read-stash PROMPT)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit-read-stash (prompt)
  (let* ((atpoint (magit-stash-at-point))
         (default (and atpoint
                       (concat atpoint (magit-rev-format " %s" atpoint))))
         (choices (mapcar (lambda (c)
                            (pcase-let ((`(,rev ,msg) (split-string c "\0")))
                              (concat (propertize rev 'face 'magit-hash)
                                      " " msg)))
                          (magit-list-stashes "%gd%x00%s")))
         (choice  (magit-completing-read prompt choices
                                         nil t nil nil
                                         default
                                         (car choices))))
    (and choice
         (string-match "^\\([^ ]+\\) \\(.+\\)" choice)
         (substring-no-properties (match-str 1 choice)))))