From 67b72ac0f2bbe268594f120370d8605e2ff170ff Mon Sep 17 00:00:00 2001 From: Jacob Lorenzen Date: Wed, 24 Jan 2018 13:41:02 +0100 Subject: [PATCH 1/2] 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. --- git-open | 1 + test/git-open.bats | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/git-open b/git-open index d952c3a..6a85f14 100755 --- a/git-open +++ b/git-open @@ -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. diff --git a/test/git-open.bats b/test/git-open.bats index 3f90fb4..91fae1c 100755 --- a/test/git-open.bats +++ b/test/git-open.bats @@ -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 .. From aea6e3edb7e4bd8d6312f0eeb83f7252da544fb5 Mon Sep 17 00:00:00 2001 From: Jacob Lorenzen Date: Tue, 20 Feb 2018 18:20:01 +0100 Subject: [PATCH 2/2] Add comment on default VSTS repository urls --- git-open | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-open b/git-open index 6a85f14..85de3b3 100755 --- a/git-open +++ b/git-open @@ -137,7 +137,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" - urlpath="${urlpath/_git\//}" + # Handle case for the default repository url + urlpath="${urlpath#_git\/*}" providerBranchRef="?id=${branch//[^0-9]/}" else # Keep project and repository name, append branch selector.