From fa0e6d1f21e10113961fe94d99d597cdfdbc9adf Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Thu, 9 Feb 2017 14:14:31 -0800 Subject: [PATCH] Revert "Merge branch 'master' into http" This reverts commit 18573f8b29fa33ae1b948cf4eb7fee39c9d7067d, reversing changes made to 88a9e254aea74e1ba36734fada9b9d9abd9df9d9. --- README.md | 12 ++---------- git-open | 18 +++++++----------- package.json | 2 +- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 9ef6d35..69b1029 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/git-open b/git-open index 826e375..6e90fab 100755 --- a/git-open +++ b/git-open @@ -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 diff --git a/package.json b/package.json index 01f1258..2410c27 100644 --- a/package.json +++ b/package.json @@ -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",