Function: magit-discard-apply

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

Signature

(magit-discard-apply SECTION:S APPLY)

Source Code

;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/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")))))