Skip to content

Commit

Permalink
Improve git_remote_connect error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Ovchinnikov-mx authored and A-Ovchinnikov-mx committed Sep 28, 2021
1 parent 5466e56 commit c1ae58d
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions LibGit2Sharp/Core/Proxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2154,17 +2154,11 @@ public static unsafe RemoteHandle git_remote_create_anonymous(RepositoryHandle r

public static unsafe void git_remote_connect(RemoteHandle remote, GitDirection direction, ref GitRemoteCallbacks remoteCallbacks, ref GitProxyOptions proxyOptions)
{
GitStrArrayManaged customHeaders = new GitStrArrayManaged();

try
using (var customHeaders = new GitStrArrayManaged())
{
int res = NativeMethods.git_remote_connect(remote, direction, ref remoteCallbacks, ref proxyOptions, ref customHeaders.Array);
Ensure.ZeroResult(res);
}
catch (Exception)
{
customHeaders.Dispose();
}
}

public static unsafe string git_remote_default_branch(RemoteHandle remote)
Expand Down

0 comments on commit c1ae58d

Please sign in to comment.