Function: magit--cherry-move-read-args

magit--cherry-move-read-args is a byte-compiled function defined in magit-sequence.el.

Signature

(magit--cherry-move-read-args VERB AWAY FN &optional ALLOW-DETACHED)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-sequence.el
(defun magit--cherry-move-read-args (verb away fn &optional allow-detached)
  (declare (indent defun))
  (let ((commits (or (nreverse (magit-region-values 'commit))
                     (list (funcall (if away
                                        #'magit-read-branch-or-commit
                                      #'magit-read-other-branch-or-commit)
                                    (format "%s cherry" (capitalize verb))))))
        (current (or (magit-get-current-branch)
                     (and allow-detached (magit-rev-parse "HEAD")))))
    (unless current
      (user-error "Cannot %s cherries while HEAD is detached" verb))
    (let ((reachable (magit-rev-ancestor-p (car commits) current))
          (msg "Cannot %s cherries that %s reachable from HEAD"))
      (pcase (list away reachable)
        ('(nil t) (user-error msg verb "are"))
        ('(t nil) (user-error msg verb "are not"))))
    `(,commits
      ,@(funcall fn commits)
      ,(transient-args 'magit-cherry-pick))))