Skip to content

Commit e4cfed0

Browse files
authored
Merge pull request #147 from mooseyboots/codeberg-permalink
Codeberg handler. format permalink correctly.
2 parents 096ef51 + e31fba5 commit e4cfed0

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

git-link-test.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
(git-link-codeberg "https://codeberg.org" "user/repo" "file.txt" "master" "abc123" 10 20)))
182182

183183
;; File link with commit instead of branch
184-
(should (equal "https://codeberg.org/user/repo/src/abc123/file.txt"
184+
(should (equal "https://codeberg.org/user/repo/src/commit/abc123/file.txt"
185185
(git-link-codeberg "https://codeberg.org" "user/repo" "file.txt" nil "abc123" nil nil))))
186186

187187

git-link.el

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -606,16 +606,16 @@ is prepended to it."
606606
(concat "https://" web-host))))
607607

608608
(defun git-link-codeberg (hostname dirname filename branch commit start end)
609-
(format "%s/%s/src/%s/%s"
610-
hostname
611-
dirname
612-
(or branch commit)
613-
(concat filename
614-
(when start
615-
(concat "#"
616-
(if end
617-
(format "L%s-L%s" start end)
618-
(format "L%s" start)))))))
609+
(format "%s/%s/src/%s/%s"
610+
hostname
611+
dirname
612+
(or branch (concat "commit/" commit))
613+
(concat filename
614+
(when start
615+
(concat "#"
616+
(if end
617+
(format "L%s-L%s" start end)
618+
(format "L%s" start)))))))
619619

620620
(defun git-link-gitlab (hostname dirname filename branch commit start end)
621621
(format "%s/%s/-/blob/%s/%s"

0 commit comments

Comments
 (0)