Revert "Merge branch 'master' into http"

This reverts commit 18573f8b29, reversing
changes made to 88a9e254ae.
This commit is contained in:
Paul Irish 2017-02-09 14:14:31 -08:00
parent d754476010
commit fa0e6d1f21
3 changed files with 10 additions and 22 deletions

View file

@ -98,19 +98,11 @@ git-open can automatically guess the corresponding repository page for remotes
#### GitLab support
To configure GitLab support you need to set some options.
| option name | description | example |
| ------------------------- | ---------------------------------------------------------- | ------------------ |
| gitopen.gitlab.domain | The (web)domain name that will work for most of the people | gitlab.example.com |
| gitopen.gitlab.ssh.domain | A specific ssh domain name, *if needed* | git.example.com |
| gitopen.gitlab.ssh.port | A specific ssh port, *if needed* | 10022 |
To configure GitLab support you need to set `gitopen.gitlab.domain`:
```sh
# use --global to set across all repos, instead of just the local one
git config [--global] gitopen.gitlab.domain [value]
git config [--global] gitopen.gitlab.ssh.domain [value]
git config [--global] gitopen.gitlab.ssh.port [value]
git config [--global] gitopen.gitlab.domain [yourdomain.here]
```
If your Gitlab custom hosted is serving `http` you can also specify this:

View file

@ -92,30 +92,26 @@ elif grep -q "/scm/" <<<$giturl; then
else
# custom GitLab
gitlab_domain=$(git config --get gitopen.gitlab.domain)
gitlab_ssh_domain=$(git config --get gitopen.gitlab.ssh.domain)
gitlab_ssh_domain=${gitlab_ssh_domain:-$gitlab_domain}
gitlab_ssh_port=$(git config --get gitopen.gitlab.ssh.port)
gitlab_port=$(git config --get gitopen.gitlab.port)
gitlab_protocol=$(git config --get gitopen.gitlab.protocol)
if [ -z "$gitlab_protocol" ]; then
gitlab_protocol=http
fi
if [ -n "$gitlab_domain" ]; then
if egrep -q "${gitlab_domain}|${gitlab_ssh_domain}" <<<$giturl; then
if [ -n "$gitlab_domain" ]; then
if grep -q "$gitlab_domain" <<<$giturl; then
# Handle GitLab's default SSH notation (like git@gitlab.domain.com:user/repo)
giturl=${giturl/git\@${gitlab_ssh_domain}\:/${gitlab_protocol}://${gitlab_domain}/}
giturl=${giturl/git\@${gitlab_domain}\:/${gitlab_protocol}://${gitlab_domain}/}
# handle SSH protocol (links like ssh://git@gitlab.domain.com/user/repo)
giturl=${giturl/#ssh\:\/\//${gitlab_protocol}://}
# remove git@ from the domain
giturl=${giturl/git\@${gitlab_ssh_domain}/${gitlab_domain}/}
giturl=${giturl/git\@${gitlab_domain}/${gitlab_domain}/}
# remove SSH port
if [ -n "$gitlab_ssh_port" ]; then
giturl=${giturl/\/:${gitlab_ssh_port}\///}
if [ -n "$gitlab_port" ]; then
giturl=${giturl/\/:${gitlab_port}\///}
fi
providerUrlDifference=tree
fi

View file

@ -1,6 +1,6 @@
{
"name": "git-open",
"version": "1.2.0",
"version": "1.1.1",
"description": "Type `git open` to open the GitHub/GitLab/Bitbucket homepage for a repository.",
"author": "Paul Irish (http://paulirish.com/)",
"license": "MIT",