microsoft / azure-devops-dotnet-samples

.NET/C# samples for integrating with Azure DevOps Services and Azure DevOps Server
https://docs.microsoft.com/azure/devops/integrate
MIT License
522 stars 519 forks source link

cannot specify a branch gitClient.GetItemsAsync #73

Closed jeffpriz closed 7 years ago

jeffpriz commented 7 years ago

I am trying to retrieve items from a specific Branch on a git repo using GetItemsAsync

It looks like I should be able to specify the branch through the GitVersionDescriptor, and by setting the version type to Branch. However, when I do so, I don't retrieve items from the branch I am attempting to get from.

my C# code is like:

GitVersionDescriptor versionDesc = new GitBaseVersionDescriptor()
{ 
   VersionType = GitVersionType.Branch,
   Version = "myBranchNameHere"
}
var task = gitClient.GetItemsAsync(repositoryId: <myrepoid>,
 recursionLevel: VersionControlRecursionType.Full, 
scopePath: "/",
 versionDescriptor: versionDesc);

that all works and I get my Items, however, the Items I get do not match the Branch, the instead come back from the repo's master branch.

Jeff

jeffpriz commented 7 years ago

ahh.. I found the issue.. Apparantly new-ing up the versionDescriptor as a Base object blew it for me. changing the above code to

GitVersionDescriptor versionDesc = new GitVersionDescriptor

now works as expected