Skip to content

Commit

Permalink
sourcehut URL fixes [fixes #77]
Browse files Browse the repository at this point in the history
  • Loading branch information
sshaw committed Dec 14, 2020
1 parent 6587f13 commit 9a3e893
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions git-link.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

;; Copyright (C) 2013-2020 Skye Shaw and others
;; Author: Skye Shaw <skye.shaw@gmail.com>
;; Version: 0.8.1
;; Version: 0.8.2
;; Keywords: git, vc, github, bitbucket, gitlab, sourcehut, convenience
;; URL: http://github.com/sshaw/git-link
;; Package-Requires: ((emacs "24.3"))
Expand Down Expand Up @@ -35,6 +35,10 @@

;;; Change Log:

;; 2020-12-14 - v0.8.2
;; * Fix sourcehut URL, don't link to raw version (Issue #77)
;; * Fix sourcehut multi-line URLs
;;
;; 2020-11-23 - v0.8.1
;; * Fix URL casing (Issue #57)
;; * Fix byte-compile warnings (Issue #75 thanks Brian Leung)
Expand Down Expand Up @@ -187,7 +191,7 @@ See its docs."
:group 'git-link)

(defcustom git-link-remote-alist
'(("git.sr.ht" git-link-github)
'(("git.sr.ht" git-link-sourcehut)
("github" git-link-github)
("bitbucket" git-link-bitbucket)
("gitorious" git-link-gitorious)
Expand Down Expand Up @@ -474,6 +478,19 @@ return (FILENAME . REVISION) otherwise nil."
(or start "")
(or end start "")))

(defun git-link-sourcehut (hostname dirname filename branch commit start end)
(format "https://%s/%s/tree/%s/%s"
hostname
dirname
(or branch commit)
(concat filename
(when start
(concat "#"
(if end
(format "L%s-%s" start end)
(format "L%s" start)))))))


(defun git-link-commit-github (hostname dirname commit)
(format "https://%s/%s/commit/%s"
hostname
Expand Down Expand Up @@ -545,7 +562,6 @@ return (FILENAME . REVISION) otherwise nil."
dir-file-name
commit)))


(defun git-link--select-remote ()
(if current-prefix-arg
(git-link--read-remote)
Expand Down

0 comments on commit 9a3e893

Please sign in to comment.