Skip to content

Commit 67b72ac

Browse files
committed
Fix bug with open -i on default VSTS project repo
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.
1 parent 51caa23 commit 67b72ac

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

git-open

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ elif [[ "${#pathargs[@]}" -ge '2' && ${pathargs[${#pathargs[@]} - 2]} == '_git'
137137
if (( is_issue )); then
138138
# Switch to workitems, provide work item id if specified
139139
urlpath="${urlpath%%/_git/*}/_workitems"
140+
urlpath="${urlpath/_git\//}"
140141
providerBranchRef="?id=${branch//[^0-9]/}"
141142
else
142143
# Keep project and repository name, append branch selector.

test/git-open.bats

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,13 @@ setup() {
361361
assert_output "http://tfs.example.com:8080/Project/Folder/_workitems?id=36"
362362
}
363363

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

365372
teardown() {
366373
cd ..

0 commit comments

Comments
 (0)