diff --git a/LibGit2Sharp/CloneOptions.cs b/LibGit2Sharp/CloneOptions.cs
index 49349daf7..068391ade 100644
--- a/LibGit2Sharp/CloneOptions.cs
+++ b/LibGit2Sharp/CloneOptions.cs
@@ -7,7 +7,7 @@ namespace LibGit2Sharp
///
/// Options to define clone behaviour
///
- public sealed class CloneOptions : IConvertableToGitCheckoutOpts, ICredentialsProvider
+ public sealed class CloneOptions : IConvertableToGitCheckoutOpts
{
///
/// Creates default for a non-bare clone
diff --git a/LibGit2Sharp/Credentials.cs b/LibGit2Sharp/Credentials.cs
index a3ad54ab6..b5540705e 100644
--- a/LibGit2Sharp/Credentials.cs
+++ b/LibGit2Sharp/Credentials.cs
@@ -1,6 +1,5 @@
using System;
using LibGit2Sharp.Core;
-using LibGit2Sharp.Handlers;
namespace LibGit2Sharp
{
@@ -20,30 +19,4 @@ public abstract class Credentials
/// 0 for success, < 0 to indicate an error, > 0 to indicate no credential was acquired.
protected internal abstract int GitCredentialHandler(out IntPtr cred, IntPtr url, IntPtr usernameFromUrl, GitCredentialType types, IntPtr payload);
}
-
- internal interface ICredentialsProvider
- {
- ///
- /// Handler to generate for authentication.
- ///
- CredentialsHandler CredentialsProvider { get; }
- }
-
- internal static class CredentialsProviderExtensions
- {
- public static CredentialsHandler GetCredentialsHandler(this ICredentialsProvider provider)
- {
- if (provider == null)
- {
- return null;
- }
-
- if (provider.CredentialsProvider == null)
- {
- return null;
- }
-
- return provider.CredentialsProvider;
- }
- }
}
diff --git a/LibGit2Sharp/FetchOptions.cs b/LibGit2Sharp/FetchOptions.cs
index 40af355c3..020f47f45 100644
--- a/LibGit2Sharp/FetchOptions.cs
+++ b/LibGit2Sharp/FetchOptions.cs
@@ -6,7 +6,7 @@ namespace LibGit2Sharp
///
/// Collection of parameters controlling Fetch behavior.
///
- public sealed class FetchOptions : ICredentialsProvider
+ public sealed class FetchOptions
{
///
/// Specifies the tag-following behavior of the fetch operation.
diff --git a/LibGit2Sharp/Network.cs b/LibGit2Sharp/Network.cs
index 09b2f2dfc..e473f0d74 100644
--- a/LibGit2Sharp/Network.cs
+++ b/LibGit2Sharp/Network.cs
@@ -100,7 +100,8 @@ static void DoFetch(RemoteSafeHandle remoteHandle, FetchOptions options, Signatu
Proxy.git_remote_set_autotag(remoteHandle, options.TagFetchMode.Value);
}
- var callbacks = new RemoteCallbacks(options);
+ var callbacks = new RemoteCallbacks(
+ options.OnProgress, options.OnTransferProgress, options.OnUpdateTips, options.CredentialsProvider);
GitRemoteCallbacks gitCallbacks = callbacks.GenerateCallbacks();
// It is OK to pass the reference to the GitCallbacks directly here because libgit2 makes a copy of
@@ -272,7 +273,8 @@ public virtual void Push(
// Load the remote.
using (RemoteSafeHandle remoteHandle = Proxy.git_remote_load(repository.Handle, remote.Name, true))
{
- var callbacks = new RemoteCallbacks(null, null, null, pushOptions);
+ var callbacks = new RemoteCallbacks(
+ null, null, null, pushOptions.CredentialsProvider);
GitRemoteCallbacks gitCallbacks = callbacks.GenerateCallbacks();
Proxy.git_remote_set_callbacks(remoteHandle, ref gitCallbacks);
diff --git a/LibGit2Sharp/PushOptions.cs b/LibGit2Sharp/PushOptions.cs
index 75b1b94ba..15e6af691 100644
--- a/LibGit2Sharp/PushOptions.cs
+++ b/LibGit2Sharp/PushOptions.cs
@@ -5,7 +5,7 @@ namespace LibGit2Sharp
///
/// Collection of parameters controlling Push behavior.
///
- public sealed class PushOptions : ICredentialsProvider
+ public sealed class PushOptions
{
///
/// Handler to generate for authentication.
diff --git a/LibGit2Sharp/RemoteCallbacks.cs b/LibGit2Sharp/RemoteCallbacks.cs
index 8adb17b4c..b2540dfbd 100644
--- a/LibGit2Sharp/RemoteCallbacks.cs
+++ b/LibGit2Sharp/RemoteCallbacks.cs
@@ -12,18 +12,6 @@ namespace LibGit2Sharp
///
internal class RemoteCallbacks
{
- internal RemoteCallbacks(
- ProgressHandler onProgress = null,
- TransferProgressHandler onDownloadProgress = null,
- UpdateTipsHandler onUpdateTips = null,
- ICredentialsProvider credentialsProvider = null)
- {
- Progress = onProgress;
- DownloadTransferProgress = onDownloadProgress;
- UpdateTips = onUpdateTips;
- CredentialsProvider = credentialsProvider.GetCredentialsHandler();
- }
-
internal RemoteCallbacks(
ProgressHandler onProgress = null,
TransferProgressHandler onDownloadProgress = null,
@@ -36,15 +24,6 @@ internal RemoteCallbacks(
CredentialsProvider = credentialsProvider;
}
- internal RemoteCallbacks(FetchOptions fetchOptions)
- {
- Ensure.ArgumentNotNull(fetchOptions, "fetchOptions");
- Progress = fetchOptions.OnProgress;
- DownloadTransferProgress = fetchOptions.OnTransferProgress;
- UpdateTips = fetchOptions.OnUpdateTips;
- CredentialsProvider = fetchOptions.GetCredentialsHandler();
- }
-
#region Delegates
///