Skip to content

Codeberg handler. format permalink correctly. - #147

Merged
sshaw merged 2 commits into
sshaw:masterfrom
martianhi:codeberg-permalink
Aug 12, 2025
Merged

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

Conversation

@martianhi

Copy link
Copy Markdown

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

sshaw commented Aug 11, 2025

Copy link
Copy Markdown
Owner

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?

@martianhi

Copy link
Copy Markdown
Author

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

Comment thread git-link.el
(format "%s/%s/src/%s/%s"
hostname
dirname
(or branch (concat "commit/" commit))

Copy link
Copy Markdown
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

sshaw commented Aug 12, 2025

Copy link
Copy Markdown
Owner

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