Skip to content

Commit

Permalink
Add support for bitbucket repos cloned with ssh
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Jayakumar <j.prabhu91@gmail.com>
  • Loading branch information
prabhu43 committed Oct 10, 2020
1 parent 14fdf5c commit f130e98
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions git-open
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ elif [[ "${#pathargs[@]}" -ge 3 && ${pathargs[${#pathargs[@]} - 3]} == 'scm' ]];
pathargs=(${pathPref[@]} 'projects' ${pathargs[${#pathargs[@]} - 2]} 'repos' "${pathargs[@]:${#pathargs[@]} - 1}")
IFS='/' urlpath="${pathargs[*]}"
providerBranchRef="/browse?at=$remote_ref"
elif [[ "$domain" == *"bitbucket"* ]] && [[ $gitprotocol == 'ssh' ]]; then
# bitbucket repo cloned with ssh will not have /scm/ segment in url path
# e.g. /ppp/test-repo.git

# Build the repo url starting with 'projects' and then keep the first argument, the string 'repos', and finally the rest of the arguments.
# shellcheck disable=SC2206
pathargs=('projects' ${pathargs[${#pathargs[@]} - 2]} 'repos' "${pathargs[@]:${#pathargs[@]} - 1}")
IFS='/' urlpath="${pathargs[*]}"
providerBranchRef="/browse?at=$remote_ref"
elif [[ "${#pathargs[@]}" -ge '2' && ${pathargs[${#pathargs[@]} - 2]} == '_git' ]]; then
# Visual Studio Team Services and Team Foundation Server always have /_git/ as the second to last segment in the url path
if (( is_issue )); then
Expand Down

0 comments on commit f130e98

Please sign in to comment.