Skip to content

Commit f3526b1

Browse files
golsbypearswj
authored andcommitted
Fixes libgit2#1217
Added CustomHeaders member to GitPushOptions to match underlying c struct for marshalling. Added tests suggested by @nulltoken to PushFixture.cs
1 parent e6f9e97 commit f3526b1

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

LibGit2Sharp.Tests/PushFixture.cs

+38
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.IO;
45
using System.Linq;
56
using LibGit2Sharp.Handlers;
@@ -60,6 +61,43 @@ private void AssertPush(Action<IRepository> push)
6061
}
6162
}
6263

64+
[Fact]
65+
public void e1217()
66+
{
67+
var scd = BuildSelfCleaningDirectory();
68+
69+
string clonedRepoPath = Repository.Clone("https://github.com/nulltoken/lg2s_issues_1217.git", scd.DirectoryPath,
70+
new CloneOptions
71+
{
72+
CredentialsProvider = dd,
73+
});
74+
75+
PushOptions options = new PushOptions()
76+
{
77+
CredentialsProvider = dd,
78+
OnPushStatusError = ss,
79+
};
80+
81+
using (var repo = new Repository(clonedRepoPath))
82+
{
83+
var file = Guid.NewGuid().ToString();
84+
Touch(repo.Info.WorkingDirectory, file, "tada");
85+
repo.Stage(file);
86+
repo.Commit("de", Constants.Signature, Constants.Signature);
87+
repo.Network.Push(repo.Network.Remotes["origin"], "HEAD", @"refs/heads/master", options);
88+
}
89+
}
90+
91+
private Credentials dd(string url, string usernamefromurl, SupportedCredentialTypes types)
92+
{
93+
return new UsernamePasswordCredentials { Username = "your_name", Password = "your_password" };
94+
}
95+
96+
private void ss(PushStatusError pushstatuserrors)
97+
{
98+
Trace.WriteLine(pushstatuserrors.Message);
99+
}
100+
63101
[Fact]
64102
public void CanPushABranchTrackingAnUpstreamBranch()
65103
{

LibGit2Sharp/Core/GitPushOptions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ internal class GitPushOptions
88
public int Version = 1;
99
public int PackbuilderDegreeOfParallelism;
1010
public GitRemoteCallbacks RemoteCallbacks;
11+
public GitStrArrayManaged CustomHeaders;
1112
}
1213
}

0 commit comments

Comments
 (0)