Add git-link-branch function

This commit is contained in:
David Morgan 2023-05-17 12:50:40 +01:00
parent 05afb02a1a
commit e17ff91dfb
Signed by: djm
GPG Key ID: C171251002C200F2
1 changed files with 9 additions and 1 deletions

View File

@ -302,11 +302,19 @@
(interactive)
(let ((git-link-use-commit nil))
(call-interactively 'git-link)))
(defun git-link-branch ()
(interactive)
(let* ((remote-info (git-link--parse-remote (git-link--remote-url (git-link--select-remote))))
(branch (git-link--branch)))
(if (null (car remote-info))
(message "Remote `%s' contains an unsupported URL" remote)
(git-link--new (format "https://%s/%s/tree/%s" (car remote-info) (cadr remote-info) branch)))))
:custom (git-link-use-commit t)
:bind
("C-c g s" . git-link)
("C-c g S" . git-link-on-branch)
("C-c g c" . git-link-commit))
("C-c g c" . git-link-commit)
("C-c g b" . git-link-branch))
(provide 'init-git)
;;; init-git.el ends here