File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,15 @@ elif [[ "${#pathargs[@]}" -ge 3 && ${pathargs[${#pathargs[@]} - 3]} == 'scm' ]];
199199 pathargs=(${pathPref[@]} ' projects' ${pathargs[${#pathargs[@]} - 2]} ' repos' " ${pathargs[@]: ${# pathargs[@]} - 1} " )
200200 IFS=' /' urlpath=" ${pathargs[*]} "
201201 providerBranchRef=" /browse?at=$remote_ref "
202+ elif [[ " $domain " == * " bitbucket" * ]] && [[ $gitprotocol == ' ssh' ]]; then
203+ # bitbucket repo cloned with ssh will not have /scm/ segment in url path
204+ # e.g. /ppp/test-repo.git
205+
206+ # Build the repo url starting with 'projects' and then keep the first argument, the string 'repos', and finally the rest of the arguments.
207+ # shellcheck disable=SC2206
208+ pathargs=(' projects' ${pathargs[${#pathargs[@]} - 2]} ' repos' " ${pathargs[@]: ${# pathargs[@]} - 1} " )
209+ IFS=' /' urlpath=" ${pathargs[*]} "
210+ providerBranchRef=" /browse?at=$remote_ref "
202211elif [[ " ${# pathargs[@]} " -ge ' 2' && ${pathargs[${#pathargs[@]} - 2]} == ' _git' ]]; then
203212 # Visual Studio Team Services and Team Foundation Server always have /_git/ as the second to last segment in the url path
204213 if (( is_issue )) ; then
Original file line number Diff line number Diff line change @@ -472,6 +472,13 @@ setup() {
472472 assert_output " https://mybb.domain.com/root/context/projects/~first.last/repos/rrr/browse?at=refs/heads/develop"
473473}
474474
475+ @test " bitbucket: Selfhosted Bitbucket Server with ssh:// clone urls" {
476+ # https://github.com/paulirish/git-open/pull/174
477+ git remote set-url origin " ssh://git@bitbucket.domain.com/ppp/rrr.git"
478+ run ../git-open
479+ assert_output " https://bitbucket.domain.com/projects/ppp/repos/rrr"
480+ }
481+
475482
476483# #
477484# # GitLab
You can’t perform that action at this time.
0 commit comments