8000 Set GitProxyOptions type to default to auto by jones-gareth · Pull Request #2043 · libgit2/libgit2sharp · GitHub
[go: up one dir, main page]

Skip to content

Set GitProxyOptions type to default to auto #2043

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

Closed
wants to merge 2 commits into from
Closed
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 = GitProxyOptions.CreateGitProxyOptions();

Proxy.git_remote_fetch(remoteHandle, refspecs, fetchOptions, logMessage);
}
Expand Down
5 changes: 5 additions & 0 deletions LibGit2Sharp/Core/GitProxyOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ internal struct GitProxyOptions
public IntPtr CredentialsCb;
public IntPtr CertificateCheck;
public IntPtr CbPayload;

internal static GitProxyOptions CreateGitProxyOptions()
{
return new GitProxyOptions { Type = GitProxyType.Auto, Version = 1 };
}
}
}
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 = GitProxyOptions.CreateGitProxyOptions();

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 = GitProxyOptions.CreateGitProxyOptions(),
});
}
}
Expand Down
8 changes: 4 additions & 4 deletions LibGit2Sharp/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ public static IEnumerable<Reference> 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 = GitProxyOptions.CreateGitProxyOptions();

if (credentialsProvider != null)
{
Expand Down Expand Up @@ -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 = GitProxyOptions.CreateGitProxyOptions();
gitFetchOptions.RemoteCallbacks = new RemoteCallbacks(options).GenerateCallbacks();
if (options.FetchOptions != null && options.FetchOptions.CustomHeaders != null)
{
Expand Down Expand Up @@ -1050,7 +1050,7 @@ public Commit Commit(string message, Signature author, Signature committer, Comm

if (treesame && !amendMergeCommit)
{
throw (options.AmendPreviousCommit ?
throw (options.AmendPreviousCommit ?
new EmptyCommitException("Amending this commit would produce a commit that is identical to its parent (id = {0})", parents[0].Id) :
new EmptyCommitException("No changes; nothing to commit."));
}
Expand Down Expand Up @@ -1241,7 +1241,7 @@ public MergeResult MergeFetchedRefs(Signature merger, MergeOptions options)
if (fetchHeads.Length == 0)
{
var expectedRef = this.Head.UpstreamBranchCanonicalName;
throw new MergeFetchHeadNotFoundException("The current branch is configured to merge with the reference '{0}' from the remote, but this reference was not fetched.",
throw new MergeFetchHeadNotFoundException("The current branch is configured to merge with the reference '{0}' from the remote, but this reference was not fetched.",
expectedRef);
}

Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/SubmoduleCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ 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 = GitProxyOptions.CreateGitProxyOptions(), RemoteCallbacks = gitRemoteCallbacks },
CloneCheckoutStrategy = CheckoutStrategy.GIT_CHECKOUT_SAFE
};

Expand Down
0