Skip to content

Commit

Permalink
Fix bug with open -i on default VSTS project repo
Browse files Browse the repository at this point in the history
The default VSTS clone url is different from other project repository urls

e.g. Default repository url: https://gitopen.visualstudio.com/_git/Project
     Sibling repository url: https://gitopen.visualstudio.com/Project/_git/Repository

     Trying to use git open -i on the default repository will lead to an
     url formatted as https://gitopen.visualstudio.com/_git/Project/_workitems?id=xx
     This url is malformed as the _git part should not be part of it.

     This change will fix this bug and correctly format url as
     https://gitopen.visualstudio.com/Project/_workitems?id=xx.
  • Loading branch information
Jaxwood committed Jan 24, 2018
1 parent 51caa23 commit 67b72ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions git-open
Expand Up @@ -137,6 +137,7 @@ elif [[ "${#pathargs[@]}" -ge '2' && ${pathargs[${#pathargs[@]} - 2]} == '_git'
if (( is_issue )); then
# Switch to workitems, provide work item id if specified
urlpath="${urlpath%%/_git/*}/_workitems"
urlpath="${urlpath/_git\//}"
providerBranchRef="?id=${branch//[^0-9]/}"
else
# Keep project and repository name, append branch selector.
Expand Down
7 changes: 7 additions & 0 deletions test/git-open.bats
Expand Up @@ -361,6 +361,13 @@ setup() {
assert_output "http://tfs.example.com:8080/Project/Folder/_workitems?id=36"
}

@test "vsts: default project repository - issue" {
git remote set-url origin "https://gitopen.visualstudio.com/_git/Project"
git checkout -B "bugfix-36"
run ../git-open "--issue"
assert_output "https://gitopen.visualstudio.com/Project/_workitems?id=36"
}


teardown() {
cd ..
Expand Down

0 comments on commit 67b72ac

Please sign in to comment.