mirror of
https://github.com/paulirish/git-open.git
synced 2026-09-15 09:46:24 -04:00
Supports separate URLs in the repo and the web
On a GitLab server. ex. --- repo: git@git.example.com:namespace/project.git web: https://gitlab.example.com/namespace/project $ git config gitopen.gitlab.domain gitlab.example.com $ git config gitopen.gitlab.ssh-domain git.example.com $ git open
This commit is contained in:
parent
ce8fb12532
commit
1808e612c5
8
git-open
8
git-open
|
|
@ -92,18 +92,20 @@ 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_port=$(git config --get gitopen.gitlab.port)
|
||||
if [ -n "$gitlab_domain" ]; then
|
||||
if grep -q "$gitlab_domain" <<<$giturl; then
|
||||
if egrep -q "${gitlab_domain}|${gitlab_ssh_domain}" <<<$giturl; then
|
||||
|
||||
# Handle GitLab's default SSH notation (like git@gitlab.domain.com:user/repo)
|
||||
giturl=${giturl/git\@${gitlab_domain}\:/https://${gitlab_domain}/}
|
||||
giturl=${giturl/git\@${gitlab_ssh_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}/}
|
||||
giturl=${giturl/git\@${gitlab_ssh_domain}/${gitlab_domain}/}
|
||||
|
||||
# remove SSH port
|
||||
if [ -n "$gitlab_port" ]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue