我获得错误tf401175:版本描述符<Branch: refs/heads/.....>无法在存储库中的版本解决。 this API调用以某种方式返回tf401175:版本描述符

问题描述 投票:0回答:1
refs/heads/{sourceBranch}

refs/heads/{targetBranch}
有人可以帮忙吗?

public async Task<GitCommitRef[]> GetCommits(string sourceBranch, string targetBranch) { VssConnection conn = new(new Uri(this._azureDevOpsUrl), new VssBasicCredential(string.Empty, pat)); GitHttpClient client = conn.GetClient<GitHttpClient>(); List<GitCommitRef> commits = []; try { List<GitCommitRef> res = await client.GetCommitsAsync(projectname, reponame, new GitQueryCommitsCriteria { ItemVersion = new GitVersionDescriptor { // I also tried refs/heads/{sourceBranch} and refs/heads/{targetBranch}, didnt work either VersionType = GitVersionType.Branch, Version = sourceBranch }, CompareVersion = new GitVersionDescriptor { VersionType = GitVersionType.Branch, Version = targetBranch } }); if (res != null) { commits.AddRange(res); } } catch (Exception ex) { ConsoleEx.Throw($"Error fetching commits: {ex.Message}"); } return commits.ToArray(); }

	
在您的代码中调用的函数'

GetCommitsAsync

'的相应的azure rest api是“
commits -getconsits
c# git azure-devops devops tfs-sdk
1个回答
0
投票
”。相应的参数为'

searchCriteria.itemVersion.version

'。

基于在此REST API的文档中共享的示例“
On a branch

”上,'enter image description heresearchCriteria.itemVersion.version

'的可接受值应该是分支的名称(例如,

main

),而不是分支的全名(例如,例如,
refs/heads/main)。
我也尝试了这个API:
如果我将'
searchCriteria.itemVersion.version
'的值设置为
refs/heads/main

,我可以获得相同的

TF401175
    错误。
  • 
    如果我将'
    searchCriteria.itemVersion.version
    '的值设置为mainenter image description here,它可以正常工作而不会出错。

  •     
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.