【发布时间】:2021-11-16 00:59:59
【问题描述】:
这是关于 libgit2sharp Remote Fixture 的 API。
我知道如何使用 Push RefSpec 从远程删除分支。但是,我想知道如何使用 API 来做到这一点。我尝试了以下示例,
Repo.Network.Push(Repo.Network.Remotes["origin"], objectish: null, destinationSpec: branchName);
我提供了正确的branchName(已选中远程)。但是,我明白了,
Unhandled exception: System.ArgumentNullException: Value cannot be null. (Parameter 'objectish')
at LibGit2Sharp.Core.Ensure.ArgumentNotNull(Object argumentValue, String argumentName) in D:\git_ws\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 24
at LibGit2Sharp.Network.Push(Remote remote, String objectish, String destinationSpec) in D:\git_ws\libgit2sharp\LibGit2Sharp\Network.cs:line 273
相关:https://github.com/libgit2/libgit2sharp/issues/466
如何正确调用Repo.Network.Push从远程删除分支。
出于好奇,我还尝试了RemoteFixture.cs 中的示例,
var remoteBranchName = "origin/" + branchName;
Repo.Branches.Remove(remoteBranchName, true);
这不会引发任何错误。但是,它什么也没做。远程分支仍然存在。
谢谢。 :)
【问题讨论】:
标签: libgit2sharp