|
1 | 1 | using System;
|
2 | 2 | using System.Collections.Generic;
|
| 3 | +using System.Diagnostics; |
3 | 4 | using System.IO;
|
4 | 5 | using System.Linq;
|
5 | 6 | using LibGit2Sharp.Handlers;
|
@@ -60,6 +61,43 @@ private void AssertPush(Action<IRepository> push)
|
60 | 61 | }
|
61 | 62 | }
|
62 | 63 |
|
| 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 | + |
63 | 101 | [Fact]
|
64 | 102 | public void CanPushABranchTrackingAnUpstreamBranch()
|
65 | 103 | {
|
|
0 commit comments