Function: forge-checkout-worktree

forge-checkout-worktree is an interactive and natively compiled function defined in forge-commands.el.

Signature

(forge-checkout-worktree PATH PULLREQ)

Documentation

Create, configure and checkout a new worktree from a pull-request.

This is like forge-checkout-pullreq, except that it also creates a new worktree. Please see the manual for more information.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/923zwib42c4qw6x4xps0cv1wi8qcd6lp-emacs-packages-deps/share/emacs/site-lisp/elpa/forge-20261005.753/forge-commands.el
;;;###autoload
(defun forge-checkout-worktree (path pullreq)
  "Create, configure and checkout a new worktree from a pull-request.
This is like `forge-checkout-pullreq', except that it also
creates a new worktree.  Please see the manual for more
information."
  (interactive
    (let ((id (forge-read-pullreq "Checkout pull request")))
      (list (funcall forge-checkout-worktree-read-directory-function
                     (forge-get-pullreq id))
            id)))
  (when (and (file-exists-p path)
             (not (and (file-directory-p path)
                       (length= (directory-files path) 2))))
    (user-error "%s already exists and isn't empty" path))
  (magit-worktree-checkout path
                           (forge--branch-pullreq (forge-get-pullreq pullreq))))