Function: magit-insert-stashes

magit-insert-stashes is a byte-compiled function defined in magit-stash.el.

Signature

(magit-insert-stashes &optional (REF "refs/stash") (HEADING "Stashes:"))

Documentation

Insert stashes section showing reflog for "refs/stash".

If optional REF is non-nil, show reflog for that instead. If optional HEADING is non-nil, use that as section heading instead of "Stashes:".

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-stash.el
(cl-defun magit-insert-stashes (&optional (ref   "refs/stash")
                                          (heading "Stashes:"))
  "Insert `stashes' section showing reflog for \"refs/stash\".
If optional REF is non-nil, show reflog for that instead.
If optional HEADING is non-nil, use that as section heading
instead of \"Stashes:\"."
  (let ((verified (magit-rev-verify ref))
        (autostash (magit-rebase--get-state-lines "autostash")))
    (when (or autostash verified)
      (magit-insert-section (stashes ref)
        (magit-insert-heading heading)
        (when autostash
          (pcase-let ((`(,author ,date ,msg)
                       (split-string
                        (car (magit-git-lines
                              "show" "-q" "--format=%aN%x00%at%x00%s"
                              autostash))
                        "\0")))
            (magit-insert-section (stash autostash)
              (insert (propertize "AUTOSTASH" 'font-lock-face 'magit-hash))
              (insert " " msg "\n")
              (magit-log-format-margin autostash author date))))
        (if verified
            (magit-git-wash (apply-partially #'magit-log-wash-log 'stash)
              "reflog" "--format=%gd%x00%aN%x00%at%x00%gs" ref)
          (insert ?\n)
          (magit-make-margin-overlay))))))