Skip to content

Enable basic proxy support in libgit2 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LibGit2Sharp/Commands/Fetch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void Fetch(Repository repository, string remote, IEnumerable<strin
fetchOptions.CustomHeaders = GitStrArrayManaged.BuildFrom(options.CustomHeaders);
}

fetchOptions.ProxyOptions = new GitProxyOptions { Version = 1 };
fetchOptions.ProxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto };

Proxy.git_remote_fetch(remoteHandle, refspecs, fetchOptions, logMessage);
}
Expand Down
4 changes: 2 additions & 2 deletions LibGit2Sharp/Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private IEnumerable<Reference> 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)
{
Expand Down Expand Up @@ -375,7 +375,7 @@ public virtual void Push(Remote remote, IEnumerable<string> pushRefSpecs, PushOp
{
PackbuilderDegreeOfParallelism = pushOptions.PackbuilderDegreeOfParallelism,
RemoteCallbacks = gitCallbacks,
ProxyOptions = new GitProxyOptions { Version = 1 },
ProxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto },
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions LibGit2Sharp/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ private static RemoteHandle ConnectToAnonymousRemote(RepositoryHandle repository
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)
{
Expand Down Expand Up @@ -810,7 +810,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)
{
Expand Down
6 changes: 5 additions & 1 deletion LibGit2Sharp/SubmoduleCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ public virtual void Update(string name, SubmoduleUpdateOptions options)
{
Version = 1,
CheckoutOptions = gitCheckoutOptions,
FetchOptions = new GitFetchOptions { ProxyOptions = new GitProxyOptions { Version = 1 }, RemoteCallbacks = gitRemoteCallbacks },
FetchOptions = new GitFetchOptions
{
ProxyOptions = new GitProxyOptions { Version = 1, Type = GitProxyType.Auto },
RemoteCallbacks = gitRemoteCallbacks
},
CloneCheckoutStrategy = CheckoutStrategy.GIT_CHECKOUT_SAFE
};

Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.110.10",
"version": "1.110.11",
"cloudBuild": {
"buildNumber": {
"enabled": true
Expand Down