From 8f1868c4062cdce33f4cc6ca7e68f08eae71a83a Mon Sep 17 00:00:00 2001 From: Kashmira Date: Mon, 17 Jun 2019 21:00:40 +0530 Subject: [PATCH 1/2] Setting Git proxy type auto where GitProxyOptions version is set to one in object initialisation --- LibGit2Sharp/Commands/Fetch.cs | 2 +- LibGit2Sharp/Network.cs | 4 ++-- LibGit2Sharp/Repository.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/LibGit2Sharp/Commands/Fetch.cs b/LibGit2Sharp/Commands/Fetch.cs index d61fca5a5..eda0a671d 100644 --- a/LibGit2Sharp/Commands/Fetch.cs +++ b/LibGit2Sharp/Commands/Fetch.cs @@ -75,7 +75,7 @@ public static void Fetch(Repository repository, string remote, IEnumerable ListReferencesInternal(string url, CredentialsHan using (RemoteHandle remoteHandle = BuildRemoteHandle(repository.Handle, url)) { GitRemoteCallbacks gitCallbacks = new GitRemoteCallbacks { version = 1 }; - GitProxyOptions proxyOptions = new GitProxyOptions { Version = 1 }; + GitProxyOptions proxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto }; if (credentialsProvider != null) { @@ -375,7 +375,7 @@ public virtual void Push(Remote remote, IEnumerable pushRefSpecs, PushOp { PackbuilderDegreeOfParallelism = pushOptions.PackbuilderDegreeOfParallelism, RemoteCallbacks = gitCallbacks, - ProxyOptions = new GitProxyOptions { Version = 1 }, + ProxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto }, }); } } diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs index b6399af45..940694ea4 100644 --- a/LibGit2Sharp/Repository.cs +++ b/LibGit2Sharp/Repository.cs @@ -678,7 +678,7 @@ public static IEnumerable ListRemoteReferences(string url, Credential using (RemoteHandle remoteHandle = Proxy.git_remote_create_anonymous(repositoryHandle, url)) { var gitCallbacks = new GitRemoteCallbacks { version = 1 }; - var proxyOptions = new GitProxyOptions { Version = 1 }; + var proxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto }; if (credentialsProvider != null) { @@ -768,7 +768,7 @@ public static string Clone(string sourceUrl, string workdirPath, var gitCheckoutOptions = checkoutOptionsWrapper.Options; var gitFetchOptions = fetchOptionsWrapper.Options; - gitFetchOptions.ProxyOptions = new GitProxyOptions { Version = 1 }; + gitFetchOptions.ProxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto }; gitFetchOptions.RemoteCallbacks = new RemoteCallbacks(options).GenerateCallbacks(); if (options.FetchOptions != null && options.FetchOptions.CustomHeaders != null) { From e6261a17a7b44b6f8655cb14f35aef3462403790 Mon Sep 17 00:00:00 2001 From: Kashmira Date: Thu, 20 Jun 2019 14:45:28 +0530 Subject: [PATCH 2/2] Making proxy change in GitProxyOptions struct instead of other classes --- LibGit2Sharp/Commands/Fetch.cs | 2 +- LibGit2Sharp/Core/GitProxyOptions.cs | 2 +- LibGit2Sharp/Network.cs | 4 ++-- LibGit2Sharp/Repository.cs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/LibGit2Sharp/Commands/Fetch.cs b/LibGit2Sharp/Commands/Fetch.cs index eda0a671d..d08d5b524 100644 --- a/LibGit2Sharp/Commands/Fetch.cs +++ b/LibGit2Sharp/Commands/Fetch.cs @@ -75,7 +75,7 @@ public static void Fetch(Repository repository, string remote, IEnumerable ListReferencesInternal(string url, CredentialsHan using (RemoteHandle remoteHandle = BuildRemoteHandle(repository.Handle, url)) { GitRemoteCallbacks gitCallbacks = new GitRemoteCallbacks { version = 1 }; - GitProxyOptions proxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto }; + GitProxyOptions proxyOptions = new GitProxyOptions { Version = 1 }; if (credentialsProvider != null) { @@ -375,7 +375,7 @@ public virtual void Push(Remote remote, IEnumerable pushRefSpecs, PushOp { PackbuilderDegreeOfParallelism = pushOptions.PackbuilderDegreeOfParallelism, RemoteCallbacks = gitCallbacks, - ProxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto }, + ProxyOptions = new GitProxyOptions { Version = 1 }, }); } } diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs index 940694ea4..b6399af45 100644 --- a/LibGit2Sharp/Repository.cs +++ b/LibGit2Sharp/Repository.cs @@ -678,7 +678,7 @@ public static IEnumerable ListRemoteReferences(string url, Credential using (RemoteHandle remoteHandle = Proxy.git_remote_create_anonymous(repositoryHandle, url)) { var gitCallbacks = new GitRemoteCallbacks { version = 1 }; - var proxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto }; + var proxyOptions = new GitProxyOptions { Version = 1 }; if (credentialsProvider != null) { @@ -768,7 +768,7 @@ public static string Clone(string sourceUrl, string workdirPath, var gitCheckoutOptions = checkoutOptionsWrapper.Options; var gitFetchOptions = fetchOptionsWrapper.Options; - gitFetchOptions.ProxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto }; + gitFetchOptions.ProxyOptions = new GitProxyOptions { Version = 1 }; gitFetchOptions.RemoteCallbacks = new RemoteCallbacks(options).GenerateCallbacks(); if (options.FetchOptions != null && options.FetchOptions.CustomHeaders != null) {