Skip to content

Commit

Permalink
Add gitea support (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 authored May 2, 2023
1 parent f772364 commit 281dad2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion git-open
Original file line number Diff line number Diff line change
Expand Up @@ -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)}}
Expand All @@ -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
Expand Down
14 changes: 14 additions & 0 deletions git-open.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 281dad2

Please sign in to comment.