diff --git a/git-open b/git-open index b55e93a..32e72bd 100755 --- a/git-open +++ b/git-open @@ -189,6 +189,8 @@ 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" + # Handle case for the default repository url + urlpath="${urlpath#_git\/*}" providerBranchRef="?id=${branch//[^0-9]/}" else # Keep project and repository name, append branch selector. diff --git a/test/git-open.bats b/test/git-open.bats index 76507b6..513535d 100755 --- a/test/git-open.bats +++ b/test/git-open.bats @@ -496,6 +496,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 ..