LibGit2Sharp 1 冲突阻止结帐

LibGit2Sharp 1 conflict prevent from checkout

我目前遇到问题,我使用 libgit2sharp 的应用程序总是崩溃并显示以下消息:

1 conflict prevents from checkout

尝试调用 repo.Pull

奇怪的是,如果我打印本地存储库的状态,它们在存储库中没有变化。

一开始我什至尝试过重置存储库,或者检出文件,但都无济于事。这是我的代码:

using (LibGit2Sharp.Repository repo = new LibGit2Sharp.Repository(path))
{
    var tipId = repo.Head.Tip.Tree;
    Log.LogManagerInstance.Instance.Info("HEAD tree id: " + tipId.Id.ToString());

    // Pull changes
    PullOptions options = new PullOptions();

    options.FetchOptions = new FetchOptions();
    options.MergeOptions = new MergeOptions();

    // ! Only for trying to fix the bug. Should not be here
    options.MergeOptions.FileConflictStrategy = CheckoutFileConflictStrategy.Theirs;

    repo.Reset(repo.Head.Tip);
    // ! --

    options.FetchOptions.CredentialsProvider = CredentialsHandler;

    Log.LogManagerInstance.Instance.Info("Try pull from remote repository");

    // Pull changes from network
    var result = repo.Network.Pull(new LibGit2Sharp.Signature(username, mail, new DateTimeOffset(DateTime.Now)), options);

    if (result != null && result.Commit != null)
    {
        Log.LogManagerInstance.Instance.Info("Pulled from remote branch, new tree id: " + result.Commit.Tree.Id.ToString());

        // get difference in the git tree (file-system)
        var diffs = repo.Diff.Compare<TreeChanges>(tipId, result.Commit.Tree);

        MergeTreeChangesToDatabase(diffs, path);
    }
    else
    {
        Log.LogManagerInstance.Instance.Info("Local repository is up-to-date with the remote branch");
    }
}

非常感谢。

编辑

Using the pre release 0.22 seems to solve my problem.

版本 0.22 修复了所有问题。