Reputation: 1
We are using the libgit2sharp library to run git commands on a repository and when there is a remote failure on pushing the git commit, the OnPushError handler doesn't get triggered.
using (var repo = new Repository(location))
{
var branch = repo.Branches["main"];
LibGit2Sharp.PushOptions options = new LibGit2Sharp.PushOptions();
options.CredentialsProvider = new UsernamePasswordCredentials();
options.OnPushStatusError = (pushStatusErrors) =>
{
foreach (var error in pushStatusErrors.AsList())
{
Console.WriteLine($"Push status error: {error.Reference} - {error.Message}");
}
};
repo.Network.Push(branch, options);
};
Expected the handler to get triggered.
Upvotes: 0
Views: 7