Function: magit-discard-apply

magit-discard-apply is a byte-compiled function defined in magit-apply.el.

Signature

(magit-discard-apply SECTION:S APPLY)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-apply.el
(defun magit-discard-apply (section:s apply)
  (let ((primus (if (atom section:s) section:s (car section:s))))
    (cond ((eq (magit-diff-type primus) 'unstaged)
           (funcall apply section:s "--reverse"))
          ((magit-anything-unstaged-p
            nil (if (magit-file-section-p primus)
                    (oref primus value)
                  (magit-section-parent-value primus)))
           (let ((magit-inhibit-refresh t))
             (funcall apply section:s "--reverse" "--cached")
             (funcall apply section:s "--reverse" "--reject"))
           (magit-refresh))
          ((funcall apply section:s "--reverse" "--index")))))