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:
parent
26c8f5c6ef
commit
44e22b7f80
4 changed files with 4 additions and 42 deletions
|
@ -133,7 +133,7 @@
|
||||||
:desc "Magit status" "g" #'magit-status
|
:desc "Magit status" "g" #'magit-status
|
||||||
:desc "Magit file delete" "x" #'magit-file-delete
|
:desc "Magit file delete" "x" #'magit-file-delete
|
||||||
:desc "Magit blame" "B" #'magit-blame-addition
|
:desc "Magit blame" "B" #'magit-blame-addition
|
||||||
:desc "Magit clone" "C" #'+magit/clone
|
:desc "Magit clone" "C" #'magit-clone
|
||||||
:desc "Magit fetch" "F" #'magit-fetch
|
:desc "Magit fetch" "F" #'magit-fetch
|
||||||
:desc "Magit buffer log" "L" #'magit-log
|
:desc "Magit buffer log" "L" #'magit-log
|
||||||
:desc "Git stage file" "S" #'magit-stage-file
|
:desc "Git stage file" "S" #'magit-stage-file
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
:desc "List notifications" "n" #'forge-list-notifications)
|
:desc "List notifications" "n" #'forge-list-notifications)
|
||||||
(:prefix ("c" . "create")
|
(:prefix ("c" . "create")
|
||||||
:desc "Initialize repo" "r" #'magit-init
|
:desc "Initialize repo" "r" #'magit-init
|
||||||
:desc "Clone repo" "R" #'+magit/clone
|
:desc "Clone repo" "R" #'magit-clone
|
||||||
:desc "Commit" "c" #'magit-commit-create
|
:desc "Commit" "c" #'magit-commit-create
|
||||||
:desc "Fixup" "f" #'magit-commit-fixup
|
:desc "Fixup" "f" #'magit-commit-fixup
|
||||||
:desc "Issue" "i" #'forge-create-issue
|
:desc "Issue" "i" #'forge-create-issue
|
||||||
|
|
|
@ -407,7 +407,7 @@
|
||||||
:desc "Magit status" "g" #'magit-status
|
:desc "Magit status" "g" #'magit-status
|
||||||
:desc "Magit file delete" "D" #'magit-file-delete
|
:desc "Magit file delete" "D" #'magit-file-delete
|
||||||
:desc "Magit blame" "B" #'magit-blame-addition
|
:desc "Magit blame" "B" #'magit-blame-addition
|
||||||
:desc "Magit clone" "C" #'+magit/clone
|
:desc "Magit clone" "C" #'magit-clone
|
||||||
:desc "Magit fetch" "F" #'magit-fetch
|
:desc "Magit fetch" "F" #'magit-fetch
|
||||||
:desc "Magit buffer log" "L" #'magit-log
|
:desc "Magit buffer log" "L" #'magit-log
|
||||||
:desc "Git stage file" "S" #'magit-stage-file
|
:desc "Git stage file" "S" #'magit-stage-file
|
||||||
|
@ -436,7 +436,7 @@
|
||||||
:desc "List notifications" "n" #'forge-list-notifications)
|
:desc "List notifications" "n" #'forge-list-notifications)
|
||||||
(:prefix ("c" . "create")
|
(:prefix ("c" . "create")
|
||||||
:desc "Initialize repo" "r" #'magit-init
|
:desc "Initialize repo" "r" #'magit-init
|
||||||
:desc "Clone repo" "R" #'+magit/clone
|
:desc "Clone repo" "R" #'magit-clone
|
||||||
:desc "Commit" "c" #'magit-commit-create
|
:desc "Commit" "c" #'magit-commit-create
|
||||||
:desc "Fixup" "f" #'magit-commit-fixup
|
:desc "Fixup" "f" #'magit-commit-fixup
|
||||||
:desc "Branch" "b" #'magit-branch-and-checkout
|
:desc "Branch" "b" #'magit-branch-and-checkout
|
||||||
|
|
|
@ -93,36 +93,3 @@ control in buffers."
|
||||||
(run-with-timer 5 nil #'+magit--kill-buffer buf)
|
(run-with-timer 5 nil #'+magit--kill-buffer buf)
|
||||||
(kill-process process)
|
(kill-process process)
|
||||||
(kill-buffer buf)))))))
|
(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))
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
;;; tools/magit/config.el -*- lexical-binding: t; -*-
|
;;; tools/magit/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar +magit-default-clone-url "https://github.com/%s/%s"
|
|
||||||
"The default location for `+magit/clone' to clone relative URLs from.
|
|
||||||
It is passed a user and repository name.")
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Packages
|
;;; Packages
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue