Function: magit-submodule-visit

magit-submodule-visit is an interactive and byte-compiled function defined in magit-submodule.el.

Signature

(magit-submodule-visit MODULE &optional OTHER-WINDOW)

Documentation

Visit MODULE by calling magit-status on it.

Offer to initialize MODULE if it's not checked out yet. With a prefix argument, visit in another window.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-submodule.el
(defun magit-submodule-visit (module &optional other-window)
  "Visit MODULE by calling `magit-status' on it.
Offer to initialize MODULE if it's not checked out yet.
With a prefix argument, visit in another window."
  (interactive (list (or (magit-section-value-if 'module)
                         (magit-read-module-path "Visit module"))
                     current-prefix-arg))
  (magit-with-toplevel
    (let ((path (expand-file-name module)))
      (cond
        ((file-exists-p (expand-file-name ".git" module))
         (magit-diff-visit-directory path other-window))
        ((y-or-n-p (format "Initialize submodule '%s' first?" module))
         (magit-run-git-async "submodule" "update" "--init" "--" module)
         (set-process-sentinel
          magit-this-process
          (lambda (process event)
            (let ((magit-process-raise-error t))
              (magit-process-sentinel process event))
            (when (and (eq (process-status      process) 'exit)
                       (=  (process-exit-status process) 0))
              (magit-diff-visit-directory path other-window)))))
        ((file-exists-p path)
         (dired-jump other-window (concat path "/.")))))))