diff options
author | Jerome Doby <xaerodegreaz@gmail.com> | 2013-02-11 01:05:16 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-02-11 01:05:50 +0400 |
commit | 3962d64c810f41556da9d28cc63ad35fcc6c6420 (patch) | |
tree | 705bb3ebcc6563d944b05b95b4f8fed7e7fbbc50 /LibGit2Sharp/NetworkExtensions.cs | |
parent | 2f18086d763d19ce61839bf78b164f1bf605a27e (diff) |
Teach Push to accept Credentials
Diffstat (limited to 'LibGit2Sharp/NetworkExtensions.cs')
-rw-r--r-- | LibGit2Sharp/NetworkExtensions.cs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/LibGit2Sharp/NetworkExtensions.cs b/LibGit2Sharp/NetworkExtensions.cs index 9e7a4129..7b260194 100644 --- a/LibGit2Sharp/NetworkExtensions.cs +++ b/LibGit2Sharp/NetworkExtensions.cs @@ -18,18 +18,20 @@ namespace LibGit2Sharp /// <param name="remote">The <see cref = "Remote" /> to push to.</param> /// <param name="objectish">The source objectish to push.</param> /// <param name="destinationSpec">The reference to update on the remote.</param> + /// <param name="credentials">Credentials to use for user/pass authentication</param> /// <returns>Results of the push operation.</returns> public static PushResult Push( this Network network, Remote remote, string objectish, - string destinationSpec) + string destinationSpec, + Credentials credentials = null) { Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNull(objectish, "objectish"); Ensure.ArgumentNotNullOrEmptyString(destinationSpec, "destinationSpec"); - return network.Push(remote, string.Format("{0}:{1}", objectish, destinationSpec)); + return network.Push(remote, string.Format("{0}:{1}", objectish, destinationSpec), credentials); } /// <summary> @@ -38,13 +40,14 @@ namespace LibGit2Sharp /// <param name="network">The <see cref="Network"/> being worked with.</param> /// <param name="remote">The <see cref = "Remote" /> to push to.</param> /// <param name="pushRefSpec">The pushRefSpec to push.</param> + /// <param name="credentials">Credentials to use for user/pass authentication</param> /// <returns>Results of the push operation.</returns> - public static PushResult Push(this Network network, Remote remote, string pushRefSpec) + public static PushResult Push(this Network network, Remote remote, string pushRefSpec, Credentials credentials = null) { Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNullOrEmptyString(pushRefSpec, "pushRefSpec"); - return network.Push(remote, new string[] { pushRefSpec }); + return network.Push(remote, new string[] { pushRefSpec }, credentials); } /// <summary> @@ -53,8 +56,9 @@ namespace LibGit2Sharp /// <param name="network">The <see cref="Network"/> being worked with.</param> /// <param name="remote">The <see cref="Remote"/> to push to.</param> /// <param name="pushRefSpecs">The pushRefSpecs to push.</param> + /// <param name="credentials">Credentials to use for user/pass authentication</param> /// <returns>Results of the push operation.</returns> - public static PushResult Push(this Network network, Remote remote, IEnumerable<string> pushRefSpecs) + public static PushResult Push(this Network network, Remote remote, IEnumerable<string> pushRefSpecs, Credentials credentials = null) { Ensure.ArgumentNotNull(remote, "remote"); Ensure.ArgumentNotNull(pushRefSpecs, "pushRefSpecs"); @@ -64,7 +68,8 @@ namespace LibGit2Sharp network.Push( remote, pushRefSpecs, - failedRemoteUpdates.Add); + failedRemoteUpdates.Add, + credentials); return new PushResult(failedRemoteUpdates); } |