Commit aaf7af15 authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-read-repository: Fallback to reading directory when appropriate

When `magit-repository-directories' is non-nil (which it recently
started to be by default) but no repository can be found in those
directories, then read a directory instead of trying to select
from an empty list of repositories (which would cause an error).

Fixes #3636.
parent 89d2d410
......@@ -251,13 +251,14 @@ to the selected repository.
With prefix argument simply read a directory name using
(if (and (not read-directory-name) magit-repository-directories)
(let* ((repos (magit-list-repos-uniquify
(--map (cons (file-name-nondirectory
(directory-file-name it))
(reply (magit-completing-read "Git repository" repos)))
(if-let ((repos (and (not read-directory-name)
(--map (cons (file-name-nondirectory
(directory-file-name it))
(let ((reply (magit-completing-read "Git repository" repos)))
(or (cdr (assoc reply repos))
(if (file-directory-p reply)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment