Skip to content

Commit 18573f8

Browse files
authored
Merge branch 'master' into http
2 parents 88a9e25 + bbc50d7 commit 18573f8

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,19 @@ git-open can automatically guess the corresponding repository page for remotes
9898
9999
#### GitLab support
100100
101-
To configure GitLab support you need to set `gitopen.gitlab.domain`:
101+
To configure GitLab support you need to set some options.
102+
103+
| option name | description | example |
104+
| ------------------------- | ---------------------------------------------------------- | ------------------ |
105+
| gitopen.gitlab.domain | The (web)domain name that will work for most of the people | gitlab.example.com |
106+
| gitopen.gitlab.ssh.domain | A specific ssh domain name, *if needed* | git.example.com |
107+
| gitopen.gitlab.ssh.port | A specific ssh port, *if needed* | 10022 |
102108
103109
```sh
104110
# use --global to set across all repos, instead of just the local one
105-
git config [--global] gitopen.gitlab.domain [yourdomain.here]
111+
git config [--global] gitopen.gitlab.domain [value]
112+
git config [--global] gitopen.gitlab.ssh.domain [value]
113+
git config [--global] gitopen.gitlab.ssh.port [value]
106114
```
107115
108116
If your Gitlab custom hosted is serving `http` you can also specify this:

git-open

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,30 @@ elif grep -q "/scm/" <<<$giturl; then
9292
else
9393
# custom GitLab
9494
gitlab_domain=$(git config --get gitopen.gitlab.domain)
95-
gitlab_port=$(git config --get gitopen.gitlab.port)
95+
gitlab_ssh_domain=$(git config --get gitopen.gitlab.ssh.domain)
96+
gitlab_ssh_domain=${gitlab_ssh_domain:-$gitlab_domain}
97+
gitlab_ssh_port=$(git config --get gitopen.gitlab.ssh.port)
98+
9699
gitlab_protocol=$(git config --get gitopen.gitlab.protocol)
97100
if [ -z "$gitlab_protocol" ]; then
98101
gitlab_protocol=http
99102
fi
100-
if [ -n "$gitlab_domain" ]; then
101-
if grep -q "$gitlab_domain" <<<$giturl; then
103+
104+
if [ -n "$gitlab_domain" ]; then
105+
if egrep -q "${gitlab_domain}|${gitlab_ssh_domain}" <<<$giturl; then
102106

103107
# Handle GitLab's default SSH notation (like git@gitlab.domain.com:user/repo)
104-
giturl=${giturl/git\@${gitlab_domain}\:/${gitlab_protocol}://${gitlab_domain}/}
108+
giturl=${giturl/git\@${gitlab_ssh_domain}\:/${gitlab_protocol}://${gitlab_domain}/}
105109

106110
# handle SSH protocol (links like ssh://git@gitlab.domain.com/user/repo)
107111
giturl=${giturl/#ssh\:\/\//${gitlab_protocol}://}
108112

109113
# remove git@ from the domain
110-
giturl=${giturl/git\@${gitlab_domain}/${gitlab_domain}/}
114+
giturl=${giturl/git\@${gitlab_ssh_domain}/${gitlab_domain}/}
111115

112116
# remove SSH port
113-
if [ -n "$gitlab_port" ]; then
114-
giturl=${giturl/\/:${gitlab_port}\///}
117+
if [ -n "$gitlab_ssh_port" ]; then
118+
giturl=${giturl/\/:${gitlab_ssh_port}\///}
115119
fi
116120
providerUrlDifference=tree
117121
fi

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "git-open",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"description": "Type `git open` to open the GitHub/GitLab/Bitbucket homepage for a repository.",
55
"author": "Paul Irish (http://paulirish.com/)",
66
"license": "MIT",

0 commit comments

Comments
 (0)