diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2019-04-23 18:03:00 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2019-04-25 13:11:05 +0200 |
| commit | a061215ae5a4a72a2e7b08719010df38fc1b0e88 (patch) | |
| tree | 64f8534d7261a2d18ad1831c9d6ea3003b70eca5 /lisp/magit-clone.el | |
| parent | 758f6d0a06a3d4551d34564dabf18766875b0583 (diff) | |
magit-clone-read-args: Let user choose how to read repository
Add new function `magit-clone-read-repository' to do so.
Diffstat (limited to 'lisp/magit-clone.el')
| -rw-r--r-- | lisp/magit-clone.el | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lisp/magit-clone.el b/lisp/magit-clone.el index 2a5dee9..2bd1300 100644 --- a/lisp/magit-clone.el +++ b/lisp/magit-clone.el @@ -185,18 +185,27 @@ Then show the status buffer for the new repository." (magit-status-setup-buffer directory)))))) (defun magit-clone-read-args () - (let ((url (magit-read-string-ns "Clone repository"))) - (list url + (let ((repo (magit-clone-read-repository))) + (list repo (read-directory-name "Clone to: " (if (functionp magit-clone-default-directory) - (funcall magit-clone-default-directory url) + (funcall magit-clone-default-directory repo) magit-clone-default-directory) nil nil - (and (string-match "\\([^/:]+?\\)\\(/?\\.git\\)?$" url) - (match-string 1 url))) + (and (string-match "\\([^/:]+?\\)\\(/?\\.git\\)?$" repo) + (match-string 1 repo))) (transient-args 'magit-clone)))) +(defun magit-clone-read-repository () + (magit-read-char-case "Clone from " nil + (?u "[u]rl" + (magit-read-string-ns "Clone from url")) + (?p "[p]ath" + (read-directory-name "Clone repository: ")) + (?l "or [l]ocal url" + (concat "file://" (read-directory-name "Clone repository: file://"))))) + ;;; _ (provide 'magit-clone) ;;; magit-clone.el ends here |
