diff --git a/.travis.yml b/.travis.yml
index d0e35f585..e7ce6e9c9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -34,4 +34,4 @@ branches:
# Notify of build changes
notifications:
email:
- - emeric.fermas@gmail.com
+ - leonardbuskin@gmail.com
diff --git a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
index 44aafabb4..1966d3fe5 100644
--- a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
+++ b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
@@ -430,7 +430,7 @@ protected static void AssertRefLogEntry(IRepository repo, string canonicalName,
Assert.Equal(@from ?? ObjectId.Zero, reflogEntry.From);
Assert.Equal(committer.Email, reflogEntry.Committer.Email);
- Assert.InRange(reflogEntry.Committer.When, before, DateTimeOffset.Now);
+ Assert.InRange(reflogEntry.Committer.When, before, DateTimeOffset.Now.AddSeconds(1));
}
protected static void EnableRefLog(IRepository repository, bool enable = true)
diff --git a/LibGit2Sharp/AuthenticationException.cs b/LibGit2Sharp/AuthenticationException.cs
new file mode 100644
index 000000000..acbf331ff
--- /dev/null
+++ b/LibGit2Sharp/AuthenticationException.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Runtime.Serialization;
+using LibGit2Sharp.Core;
+
+namespace LibGit2Sharp
+{
+ ///
+ /// The exception that is thrown when an operation which requires an
+ /// authentication fails.
+ ///
+ [Serializable]
+ public class AuthenticationException : LibGit2SharpException
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public AuthenticationException()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class with a specified error message.
+ ///
+ /// A message that describes the error.
+ public AuthenticationException(string message)
+ : base(message)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception. If the parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception.
+ public AuthenticationException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class with a serialized data.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected AuthenticationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+ internal AuthenticationException(string message, GitErrorCode code, GitErrorCategory category)
+ : base(message, code, category)
+ {
+ }
+ }
+}
diff --git a/LibGit2Sharp/CertificateSsh.cs b/LibGit2Sharp/CertificateSsh.cs
index 3c66bd995..73a333acf 100644
--- a/LibGit2Sharp/CertificateSsh.cs
+++ b/LibGit2Sharp/CertificateSsh.cs
@@ -41,7 +41,6 @@ protected CertificateSsh()
internal unsafe CertificateSsh(git_certificate_ssh* cert)
{
-
HasMD5 = cert->type.HasFlag(GitCertificateSshType.MD5);
HasSHA1 = cert->type.HasFlag(GitCertificateSshType.SHA1);
@@ -50,7 +49,7 @@ internal unsafe CertificateSsh(git_certificate_ssh* cert)
{
for (var i = 0; i < HashMD5.Length; i++)
{
- HashMD5[i] = p[i];
+ p[i] = cert->HashMD5[i];
}
}
@@ -59,7 +58,7 @@ internal unsafe CertificateSsh(git_certificate_ssh* cert)
{
for (var i = 0; i < HashSHA1.Length; i++)
{
- HashSHA1[i] = p[i];
+ p[i] = cert->HashSHA1[i];
}
}
}
diff --git a/LibGit2Sharp/Core/Ensure.cs b/LibGit2Sharp/Core/Ensure.cs
index d82fa3a4b..cf327d544 100644
--- a/LibGit2Sharp/Core/Ensure.cs
+++ b/LibGit2Sharp/Core/Ensure.cs
@@ -127,7 +127,8 @@ private static readonly Dictionary new CheckoutConflictException(m, r, c) },
{ GitErrorCode.LockedFile, (m, r, c) => new LockedFileException(m, r, c) },
{ GitErrorCode.NotFound, (m, r, c) => new NotFoundException(m, r, c) },
- { GitErrorCode.Peel, (m, r, c) => new PeelException(m, r, c) },
+ { GitErrorCode.Peel, (m, r, c) => new PeelException(m, r, c) },
+ { GitErrorCode.Auth, (m, r, c) => new AuthenticationException(m, r, c) },
};
private static unsafe void HandleError(int result)
diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs
index e8ab4cc7a..eae68964e 100644
--- a/LibGit2Sharp/Core/NativeMethods.cs
+++ b/LibGit2Sharp/Core/NativeMethods.cs
@@ -496,6 +496,24 @@ internal static extern int git_cred_userpass_plaintext_new(
[DllImport(libgit2)]
internal static extern void git_cred_free(IntPtr cred);
+
+ [DllImport(libgit2)]
+ internal static extern int git_cred_ssh_key_new(
+ out IntPtr cred,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string username,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string publickey,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string privatekey,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string passphrase);
+
+ [DllImport(libgit2)]
+ internal static extern int git_cred_ssh_key_from_agent(
+ out IntPtr cred,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string username);
+
+ [DllImport(libgit2)]
+ internal static extern int git_cred_username_new(
+ out IntPtr cred,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string username);
[DllImport(libgit2)]
internal static extern unsafe int git_describe_commit(
diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj
index e436644ab..9c06f2890 100644
--- a/LibGit2Sharp/LibGit2Sharp.csproj
+++ b/LibGit2Sharp/LibGit2Sharp.csproj
@@ -1,6 +1,6 @@
-
+
Debug
AnyCPU
@@ -53,6 +53,7 @@
+
@@ -162,6 +163,8 @@
+
+
@@ -327,6 +330,7 @@
+
@@ -384,7 +388,7 @@
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
+