Skip to content

Commit

Permalink
Clarify support for cgit and gitea
Browse files Browse the repository at this point in the history
  • Loading branch information
sshaw committed Jul 23, 2024
1 parent c48d9ed commit db586e9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions git-link.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit db586e9

Please sign in to comment.