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