-
Notifications
You must be signed in to change notification settings - Fork 254
Fix bug with open -i on default VSTS project repo #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
@ethomson If you have a second can you confirm this? |
@ethomson could you review it? |
Thanks for the ping. This looks like an accurate assessment of the problem to me. 👍 |
@derimagia not sure if you have seen @ethomson comment above? |
Hm looking at the code for this specifically your line does what the above line should have done. The issue is it trims the "/_git*" off the end of the url but the beginning slash doesn't exist so it doesn't do anything besides append the _workitems string to it. Can you combine this and the above line? Something like |
@derimagia I tried to make the change you suggested - however it seems like it is not working as one of the testcases for issues is failing. |
@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"
}
@test "vsts: issue, default project repository" {
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"
} @ethomson First one was there before, second one is from this. Only difference I see is it's in the folder so it has a prefix to the urlpath. Question is - are they both correct? Top one is removing everything after the _git while the bottom one doesn't and shifts it around. |
@ethomson if you have the time I would appreciate if you could look at what @derimagia wrote above |
They’re both correct. VSTS has a concept of a “project”, which is a unit of team management. A project can have one or more Git repositories. The top form is canonical, specifying some repository in the project, explicitly. The latter is shorthand for the default repository. The work item link appears to be constructed correctly |
@derimagia did you see the update from @ethomson ? |
Can you switch the second line to: urlpath="${urlpath#_git\/*}" Which will remove the first "_git" argument found in the path. The first line removes /_git/* from the url as long as it's not the first item in the path so these together seem to work. If you can make a quick comment about taking care of both cases then we should be good to go. |
@derimagia thank you for taking the time to look into this. Please see my latest update. |
Fix bug with open -i on default VSTS project repo
The default VSTS clone url is different from other project repository urls
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