Function: magit-read-repository
magit-read-repository is a byte-compiled function defined in
magit-repos.el.
Signature
(magit-read-repository &optional READ-DIRECTORY-NAME)
Documentation
Read a Git repository in the minibuffer, with completion.
The completion choices are the basenames of top-levels of
repositories found in the directories specified by option
magit-repository-directories. In case of name conflicts
the basenames are prefixed with the name of the respective
parent directories. The returned value is the actual path
to the selected repository.
If READ-DIRECTORY-NAME is non-nil or no repositories can be
found based on the value of magit-repository-directories,
then read an arbitrary directory using read-directory-name
instead.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-repos.el
;;; Read Repository
(defun magit-read-repository (&optional read-directory-name)
"Read a Git repository in the minibuffer, with completion.
The completion choices are the basenames of top-levels of
repositories found in the directories specified by option
`magit-repository-directories'. In case of name conflicts
the basenames are prefixed with the name of the respective
parent directories. The returned value is the actual path
to the selected repository.
If READ-DIRECTORY-NAME is non-nil or no repositories can be
found based on the value of `magit-repository-directories',
then read an arbitrary directory using `read-directory-name'
instead."
(if-let ((repos (and (not read-directory-name)
magit-repository-directories
(magit-repos-alist))))
(let ((reply (magit-completing-read "Git repository" repos nil 'any)))
(file-name-as-directory
(or (cdr (assoc reply repos))
(if (file-directory-p reply)
(expand-file-name reply)
(user-error "Not a repository or a directory: %s" reply)))))
(file-name-as-directory
(read-directory-name "Git repository: "
(or (magit-toplevel) default-directory)))))