tools/magit: replace +magit/clone w/ magit-clone

The former no longer works, since ghub's API has changed. Meanwhile, the
magit-clone command has grown in features to match (and surpass)
+magit/clone, so we'll just use that instead.
This commit is contained in:
Henrik Lissner 2019-11-23 00:54:11 -05:00
parent 26c8f5c6ef
commit 44e22b7f80
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 4 additions and 42 deletions

View file

@ -93,36 +93,3 @@ control in buffers."
(run-with-timer 5 nil #'+magit--kill-buffer buf)
(kill-process process)
(kill-buffer buf)))))))
(defvar +magit-clone-history nil
"History for `+magit/clone' prompt.")
;;;###autoload
(defun +magit/clone (url-or-repo dir)
"Like `magit-clone', but supports additional formats on top of absolute URLs:
+ USER/REPO: assumes {`+magit-default-clone-url'}/USER/REPO
+ REPO: assumes {`+magit-default-clone-url'}/{USER}/REPO, where {USER} is
ascertained from your global gitconfig."
(interactive
(progn
(require 'ghub)
(let* ((user (ghub--username (ghub--host)))
(repo (read-from-minibuffer
"Clone repository (user/repo or url): "
(if user (concat user "/"))
nil nil '+magit-clone-history))
(name (car (last (split-string repo "/" t)))))
(list repo
(read-directory-name
"Destination: "
magit-clone-default-directory
name nil name)))))
(magit-clone-regular
(cond ((string-match-p "^[^/]+$" url-or-repo)
(require 'ghub)
(format +magit-default-clone-url (ghub--username (ghub--host)) url-or-repo))
((string-match-p "^\\([^/]+\\)/\\([^/]+\\)/?$" url-or-repo)
(apply #'format +magit-default-clone-url (split-string url-or-repo "/" t)))
(url-or-repo))
dir
nil))