mirror of
https://github.com/paulirish/git-open.git
synced 2026-09-10 07:26:15 -04:00
Issues for Visual Studio Team Services
Provide issue support for VSTS and TFS, modifying the URL from the `_git` endpoint to the `_workitems` endpoint and appending the `id` query string.
This commit is contained in:
parent
7642ca2970
commit
a3cf0d02fb
12
git-open
12
git-open
|
|
@ -131,9 +131,15 @@ elif [[ ${pathargs[0]} == 'scm' ]]; then
|
|||
IFS='/' urlpath="${pathargs[*]}"
|
||||
providerBranchRef="/browse?at=$branch"
|
||||
elif [[ "${#pathargs[@]}" -ge '2' && ${pathargs[${#pathargs[@]} - 2]} == '_git' ]]; then
|
||||
# Visual Studio Team Services and Team Foundation Server: keep the
|
||||
# Team Project and repository name, append branch selector.
|
||||
providerBranchRef="?version=GB$branch"
|
||||
# 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
|
||||
# Switch to workitems, provide work item id if specified
|
||||
urlpath="${urlpath%%/_git/*}/_workitems"
|
||||
providerBranchRef="?id=${branch//[^0-9]/}"
|
||||
else
|
||||
# Keep project and repository name, append branch selector.
|
||||
providerBranchRef="?version=GB$branch"
|
||||
fi
|
||||
fi
|
||||
|
||||
openurl="$protocol://$domain/$urlpath"
|
||||
|
|
|
|||
|
|
@ -356,6 +356,13 @@ setup() {
|
|||
assert_output "http://tfs.example.com:8080/Project/Folder/_git/Repository?version=GBmybranch"
|
||||
}
|
||||
|
||||
@test "vsts: issue" {
|
||||
git remote set-url origin "http://tfs.example.com:8080/Project/Folder/_git/Repository"
|
||||
git checkout -B "bugfix-36"
|
||||
run ../git-open "--issue"
|
||||
assert_output "http://tfs.example.com:8080/Project/Folder/_workitems?id=36"
|
||||
}
|
||||
|
||||
|
||||
teardown() {
|
||||
cd ..
|
||||
|
|
|
|||
Loading…
Reference in a new issue