Skip to content

Commit 281dad2

Browse files
Add gitea support (#184)
1 parent f772364 commit 281dad2

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

git-open

+6-1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ function getConfig() {
168168

169169
domain=$(getConfig "domain")
170170
protocol=$(getConfig "protocol")
171+
forge=$(getConfig "forge")
171172

172173
# Remote ref to open
173174
remote_ref=${upstream_branch:-${branch:-$(git describe --tags --exact-match 2>/dev/null || git rev-parse HEAD)}}
@@ -183,7 +184,11 @@ else
183184
# Make # and % characters url friendly
184185
# github.com/paulirish/git-open/pull/24
185186
remote_ref=${remote_ref//%/%25} remote_ref=${remote_ref//#/%23}
186-
providerBranchRef="/tree/$remote_ref"
187+
if [[ $forge == 'gitea' ]]; then
188+
providerBranchRef="/src/branch/$remote_ref"
189+
else
190+
providerBranchRef="/tree/$remote_ref"
191+
fi
187192
fi
188193

189194
if [[ "$domain" == 'bitbucket.org' ]]; then

git-open.1.md

+14
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@ git config open.default.remote upstream
118118
This is equivalent to always typing `git open upstream`.
119119

120120

121+
### Gitea options
122+
123+
To configure Gitea support you need to set the following option.
124+
125+
`open.[gitdomain].forge`
126+
The git forge present at the git domain. This only needs to be set for Gitea because it uses another branch URL format.
127+
128+
**Example**
129+
130+
```sh
131+
git config [--global] "open.https://gitea.internal.biz.forge" "gitea"
132+
```
133+
134+
121135
### GitLab options
122136

123137
To configure GitLab support (or other unique hosting situations) you may need to set some options.

0 commit comments

Comments
 (0)