Function: magit-apply-region

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

Signature

(magit-apply-region HUNK &rest ARGS)

Source Code

;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/magit-apply.el
(defun magit-apply-region (hunk &rest args)
  (let ((file (oref hunk parent)))
    (when (magit-diff--combined-p file)
      (user-error "Cannot un-/stage resolution hunks.  Stage the whole file"))
    (magit-apply-patch
     file args
     (concat (magit-diff-file-header hunk)
             (magit-apply--adjust-hunk-new-start
              (magit-diff-hunk-region-patch hunk args))))))