8000 Drop internal ICredentialsProvider · coding2233/libgit2sharp4unity3d@4341e7e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4341e7e

Browse files
committed
Drop internal ICredentialsProvider
1 parent cd9732f commit 4341e7e

File tree

6 files changed

+7
-53
lines changed

6 files changed

+7
-53
lines changed

LibGit2Sharp/CloneOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace LibGit2Sharp
77
/// <summary>
88
/// Options to define clone behaviour
99
/// </summary>
10-
public sealed class CloneOptions : IConvertableToGitCheckoutOpts, ICredentialsProvider
10+
public sealed class CloneOptions : IConvertableToGitCheckoutOpts
1111
{
1212
/// <summary>
1313
/// Creates default <see cref="CloneOptions"/> for a non-bare clone

LibGit2Sharp/Credentials.cs

Lines changed: 0 additions & 27 deletions
< 8000 td data-grid-cell-id="diff-a16f50c9936ac47a60793afdadd462ebf75d4d3ae0fa370228154558861e3544-2-2-1" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative diff-line-number-neutral left-side">2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2
using LibGit2Sharp.Core;
3-
using LibGit2Sharp.Handlers;
43

54
namespace LibGit2Sharp
65
{
@@ -20,30 +19,4 @@ public abstract class Credentials
2019
/// <returns>0 for success, &lt; 0 to indicate an error, &gt; 0 to indicate no credential was acquired.</returns>
2120
protected internal abstract int GitCredentialHandler(out IntPtr cred, IntPtr url, IntPtr usernameFromUrl, GitCredentialType types, IntPtr payload);
2221
}
23-
24-
internal interface ICredentialsProvider
25-
{
26-
/// <summary>
27-
/// Handler to generate <see cref="LibGit2Sharp.Credentials"/> for authentication.
28-
/// </summary>
29-
CredentialsHandler CredentialsProvider { get; }
30-
}
31-
32-
internal static class CredentialsProviderExtensions
33-
{
34-
public static CredentialsHandler GetCredentialsHandler(this ICredentialsProvider provider)
35-
{
36-
if (provider == null)
37-
{
38-
return null;
39-
}
40-
41-
if (provider.CredentialsProvider == null)
42-
{
43-
return null;
44-
}
45-
46-
return provider.CredentialsProvider;
47-
}
48-
}
4922
}

LibGit2Sharp/FetchOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace LibGit2Sharp
66
/// <summary>
77
/// Collection of parameters controlling Fetch behavior.
88
/// </summary>
9-
public sealed class FetchOptions : ICredentialsProvider
9+
public sealed class FetchOptions
1010
{
1111
/// <summary>
1212
/// Specifies the tag-following behavior of the fetch operation.

LibGit2Sharp/Network.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ static void DoFetch(RemoteSafeHandle remoteHandle, FetchOptions options, Signatu
100100
Proxy.git_remote_set_autotag(remoteHandle, options.TagFetchMode.Value);
101101
}
102102

103-
var callbacks = new RemoteCallbacks(options);
103+
var callbacks = new RemoteCallbacks(
104+
options.OnProgress, options.OnTransferProgress, options.OnUpdateTips, options.CredentialsProvider);
104105
GitRemoteCallbacks gitCallbacks = callbacks.GenerateCallbacks();
105106

106107
// 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(
272273
// Load the remote.
273274 8000
using (RemoteSafeHandle remoteHandle = Proxy.git_remote_load(repository.Handle, remote.Name, true))
274275
{
275-
var callbacks = new RemoteCallbacks(null, null, null, pushOptions);
276+
var callbacks = new RemoteCallbacks(
277+
null, null, null, pushOptions.CredentialsProvider);
276278
GitRemoteCallbacks gitCallbacks = callbacks.GenerateCallbacks();
277279
Proxy.git_remote_set_callbacks(remoteHandle, ref gitCallbacks);
278280

LibGit2Sharp/PushOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace LibGit2Sharp
55
/// <summary>
66
/// Collection of parameters controlling Push behavior.
77
/// </summary>
8-
public sealed class PushOptions : ICredentialsProvider
8+
public sealed class PushOptions
99
{
1010
/// <summary>
1111
/// Handler to generate <see cref="LibGit2Sharp.Credentials"/> for authentication.

LibGit2Sharp/RemoteCallbacks.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ namespace LibGit2Sharp
1212
/// </summary>
1313
internal class RemoteCallbacks
1414
{
15-
internal RemoteCallbacks(
16-
ProgressHandler onProgress = null,
17-
TransferProgressHandler onDownloadProgress = null,
18-
UpdateTipsHandler onUpdateTips = null,
19-
ICredentialsProvider credentialsProvider = null)
20-
{
21-
Progress = onProgress;
22-
DownloadTransferProgress = onDownloadProgress;
23-
UpdateTips = onUpdateTips;
24-
CredentialsProvider = credentialsProvider.GetCredentialsHandler();
25-
}
26-
2715
internal RemoteCallbacks(
2816
ProgressHandler onProgress = null,
2917
TransferProgressHandler onDownloadProgress = null,
@@ -36,15 +24,6 @@ internal RemoteCallbacks(
3624
CredentialsProvider = credentialsProvider;
3725
}
3826

39-
internal RemoteCallbacks(FetchOptions fetchOptions)
40-
{
41-
Ensure.ArgumentNotNull(fetchOptions, "fetchOptions");
42-
Progress = fetchOptions.OnProgress;
43-
DownloadTransferProgress = fetchOptions.OnTransferProgress;
44-
UpdateTips = fetchOptions.OnUpdateTips;
45-
CredentialsProvider = fetchOptions.GetCredentialsHandler();
46-
}
47-
4827
#region Delegates
4928

5029
/// <summary>

0 commit comments

Comments
 (0)
0