Add gitea support (#184)

This commit is contained in:
Sandro 2023-05-02 20:29:10 +02:00 committed by GitHub
parent f772364eb8
commit 281dad270e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View file

@ -168,6 +168,7 @@ function getConfig() {
domain=$(getConfig "domain")
protocol=$(getConfig "protocol")
forge=$(getConfig "forge")
# Remote ref to open
remote_ref=${upstream_branch:-${branch:-$(git describe --tags --exact-match 2>/dev/null || git rev-parse HEAD)}}
@ -183,7 +184,11 @@ else
# Make # and % characters url friendly
# github.com/paulirish/git-open/pull/24
remote_ref=${remote_ref//%/%25} remote_ref=${remote_ref//#/%23}
providerBranchRef="/tree/$remote_ref"
if [[ $forge == 'gitea' ]]; then
providerBranchRef="/src/branch/$remote_ref"
else
providerBranchRef="/tree/$remote_ref"
fi
fi
if [[ "$domain" == 'bitbucket.org' ]]; then

View file

@ -118,6 +118,20 @@ git config open.default.remote upstream
This is equivalent to always typing `git open upstream`.
### Gitea options
To configure Gitea support you need to set the following option.
`open.[gitdomain].forge`
The git forge present at the git domain. This only needs to be set for Gitea because it uses another branch URL format.
**Example**
```sh
git config [--global] "open.https://gitea.internal.biz.forge" "gitea"
```
### GitLab options
To configure GitLab support (or other unique hosting situations) you may need to set some options.