Fix vcs/git-browse* commands #616

Caused by upstream changes to git-link, where `git-link--remote-host' was
removed.
This commit is contained in:
Henrik Lissner 2018-05-26 11:13:21 +02:00
parent 80fe6aa082
commit dc86b61704
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -2,13 +2,12 @@
;;;###autoload
(defun +vcs-root ()
"Get git url root."
(require 'git-link)
(let ((remote (git-link--select-remote)))
(if (git-link--remote-host remote)
(format "https://%s/%s"
(git-link--remote-host remote)
(git-link--remote-dir remote))
"Return the root git repo URL for the current file."
(let* ((remote (git-link--select-remote))
(remote-url (git-link--remote-url remote))
(remote-info (if remote-url (git-link--parse-remote remote-url))))
(if remote-info
(format "https://%s/%s" (car remote-info) (cadr remote-info))
(error "Remote `%s' is unknown or contains an unsupported URL" remote))))
(defvar git-link-open-in-browser)
@ -25,11 +24,15 @@ repository root."
;;;###autoload
(defun +vcs/git-browse-issues ()
"Open the github issues page for current repo."
"Open the issues page for current repo."
(interactive)
(if-let* ((root (+vcs-root)))
(browse-url (concat root "/issues"))
(user-error "No git root found!")))
(browse-url (format "%s/issues" (+vcs-root))))
;;;###autoload
(defun +vcs/git-browse-pulls ()
"Open the pull requests page for current repo."
(interactive)
(browse-url (format "%s/pulls" (+vcs-root))))
;;;###autoload
(defun +vcs*update-header-line (revision)