Skip to content

Comments

Codeberg handler. format permalink correctly.#147

Merged
sshaw merged 2 commits intosshaw:masterfrom
mooseyboots:codeberg-permalink
Aug 12, 2025
Merged

Codeberg handler. format permalink correctly.#147
sshaw merged 2 commits intosshaw:masterfrom
mooseyboots:codeberg-permalink

Conversation

@mooseyboots
Copy link

Codeberg permalinks add /commit/ after /src and before the commit hash. This PR makes git-link create correct permalinks to code references for Codeberg.

Currently, if you visit a git-link created commit URL in the browser, Forgejo/Codeberg will re-write it to add the /commit/ part. I'm working on an emacs client for Forgejo (https://codeberg.org/martianh/fj.el), so I can't benefit from such re-writing and need git-link to create the right kind of permalink.

@sshaw
Copy link
Owner

sshaw commented Aug 11, 2025

Thanks for the PR!

Glad to see the links are at least working 😅

This broke a test or two. Do you mind making the appropriate update to fix it?

@mooseyboots
Copy link
Author

@sshaw i added a fix. only one test broke for me locally, now it passes.

(format "%s/%s/src/%s/%s"
hostname
dirname
(or branch (concat "commit/" commit))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When not using a commit branch is appended to the branch name, e.g., https://codeberg.org/martianh/fj.el/src/main/fj-transient.el#L301 -> https://codeberg.org/martianh/fj.el/src/branch/main/fj-transient.el#L305

@sshaw
Copy link
Owner

sshaw commented Aug 12, 2025

Great thanks! Left a note for reference but this is good to go!

@sshaw sshaw merged commit e4cfed0 into sshaw:master Aug 12, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants