mirror of
https://github.com/paulirish/git-open.git
synced 2026-09-10 07:26:15 -04:00
Merge pull request #51 from evoactivity/patch-1
Handle gitlab using SSH remote URL
This commit is contained in:
commit
485bb31427
13
git-open
13
git-open
|
|
@ -92,9 +92,20 @@ elif grep -q "/scm/" <<<$giturl; then
|
|||
else
|
||||
# custom GitLab
|
||||
gitlab_domain=$(git config --get gitopen.gitlab.domain)
|
||||
gitlab_port=$(git config --get gitopen.gitlab.port)
|
||||
if [ -n "$gitlab_domain" ]; then
|
||||
if grep -q "$gitlab_domain" <<<$giturl; then
|
||||
giturl=${giturl/git\@${gitlab_domain}:/https://${gitlab_domain}/}
|
||||
|
||||
# handle SSH protocol (links like ssh://git@gitlab.domain.com/user/repo)
|
||||
giturl=${giturl/#ssh\:\/\//https://}
|
||||
|
||||
# remove git@ from the domain
|
||||
giturl=${giturl/git\@${gitlab_domain}/${gitlab_domain}/}
|
||||
|
||||
# remove SSH port
|
||||
if [ -n "$gitlab_port" ]; then
|
||||
giturl=${giturl/\/:${gitlab_port}\///}
|
||||
fi
|
||||
providerUrlDifference=tree
|
||||
fi
|
||||
# hosted GitLab
|
||||
|
|
|
|||
Loading…
Reference in a new issue