From db586e906a926785bbf960f3714d70dc11b019b9 Mon Sep 17 00:00:00 2001 From: sshaw Date: Mon, 22 Jul 2024 17:14:58 -0700 Subject: [PATCH] Clarify support for cgit and gitea --- README.md | 28 ++++++++++++++++++++++++++++ git-link.el | 3 +++ 2 files changed, 31 insertions(+) diff --git a/README.md b/README.md index ad819ef5..19067523 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ Name of the remote branch to link to. * [cgit](https://wiki.archlinux.org/title/Cgit) * [GitHub](http://github.com) * [GitLab](https://gitlab.com) +* [Gitea](https://about.gitea.com/) * [Gitorious](http://gitorious.org) * [GoogleSource](https://googlesource.com) * [Savannah](https://git.savannah.gnu.org/cgit) @@ -105,6 +106,33 @@ If [`git-timemachine-mode`](https://codeberg.org/pidu/git-timemachine) is active `git-link` generates a URL for the version of the file being visited. +### cgit and Gitea + +git-link comes with functions for linking to repositories hosted by these services but, because they're self-hosted there is no default URL to match. +To make git-link work with these you must configure your URLs to use the appropriate matching function. + +### cgit + +```el +(eval-after-load 'git-link + '(progn + (add-to-list 'git-link-remote-alist + '("your-cgit\\.example\\.com" git-link-cgit)) + (add-to-list 'git-link-commit-remote-alist + '("your-cgit\\.domain\\.tld" git-link-commit-cgit)))) +``` + +### Gitea + +```el +(eval-after-load 'git-link + '(progn + (add-to-list 'git-link-remote-alist + '("your-gitea\\.example\\.com" git-link-gitea)) + (add-to-list 'git-link-commit-remote-alist + '("your-gitea\\.domain\\.tld" git-link-commit-gitea)))) +``` + ### Sourcegraph To link to files on a Sourcegraph server add a git remote pointing to the repository's Sourcegraph page: diff --git a/git-link.el b/git-link.el index 24c0fda3..c8605dbe 100644 --- a/git-link.el +++ b/git-link.el @@ -785,6 +785,9 @@ return (FILENAME . REVISION) otherwise nil." (define-obsolete-function-alias 'git-link-homepage-svannah 'git-link-homepage-savannah "cf947f9") +(defalias 'git-link-gitea 'git-link-codeberg) +(defalias 'git-link-commit-gitea 'git-link-commit-codeberg) + (defun git-link--select-remote () (if (equal '(4) current-prefix-arg) (git-link--read-remote)