Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle gitlab using SSH remote URL #51

Merged
merged 1 commit into from
Aug 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion git-open
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down