From 197a681314050c70a2667ec8a7aec8bdd209c0d7 Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Mon, 23 Feb 2015 16:13:23 -0800 Subject: [PATCH] simplify gitlab. --- git-open | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/git-open b/git-open index 9335ab3..0166ee7 100755 --- a/git-open +++ b/git-open @@ -43,11 +43,11 @@ else fi # URL normalization -# Github support +# Github if grep -q github <<<$giturl; then giturl=${giturl/git\@github\.com\:/https://github.com/} providerUrlDifference=tree -# bitbucket support +# bitbucket elif grep -q bitbucket <<<$giturl; then giturl=${giturl/git\@bitbucket\.org\:/https://bitbucket.org/} providerUrlDifference=branch @@ -64,18 +64,17 @@ giturl=${giturl%\.git} branch="?at=refs%2Fheads%2F${branch}" fi else + # custom gitlab gitlab_domain=$(git config --get gitopen.gitlab.domain) if [ ! -z "$gitlab_domain" ]; then if grep -q $gitlab_domain <<<$giturl; then giturl=${giturl/git\@${gitlab_domain}:/https://${gitlab_domain}/} - - gitlab_urldifference=$(git config --get gitopen.gitlab.urldifference) - if [ -z "$gitlab_urldifference" ]; then - providerUrlDifference=tree - else - providerUrlDifference=$gitlab_urldifference - fi + providerUrlDifference=tree fi + # hosted gitlab + elif grep -q gitlab <<<$giturl; then + giturl=${giturl/git\@gitlab\.com\:/https://gitlab.com/} + providerUrlDifference=tree fi fi giturl=${giturl%\.git}