diff options
author | nulltoken <emeric.fermas@gmail.com> | 2013-08-16 14:45:29 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-08-19 22:45:18 +0400 |
commit | f7c05c688bfacfc0e93cfceb2b125918ae973305 (patch) | |
tree | 135b02fac96b9c4951808436d8e6d8eab71ef0f8 | |
parent | 7b7aef0abfaca5c1b9374c9cdda46635b1c53d67 (diff) |
Update libgit2 binaries to eb04744
https://github.com/libgit2/libgit2/compare/7940036...eb04744
-rw-r--r-- | Lib/NativeBinaries/amd64/git2-7940036.dll | bin | 810496 -> 0 bytes | |||
-rw-r--r-- | Lib/NativeBinaries/amd64/git2-7940036.pdb | bin | 5287936 -> 0 bytes | |||
-rw-r--r-- | Lib/NativeBinaries/amd64/git2-eb04744.dll | bin | 0 -> 798208 bytes | |||
-rw-r--r-- | Lib/NativeBinaries/amd64/git2-eb04744.pdb | bin | 0 -> 4943872 bytes | |||
-rw-r--r-- | Lib/NativeBinaries/x86/git2-7940036.dll | bin | 622080 -> 0 bytes | |||
-rw-r--r-- | Lib/NativeBinaries/x86/git2-7940036.pdb | bin | 5271552 -> 0 bytes | |||
-rw-r--r-- | Lib/NativeBinaries/x86/git2-eb04744.dll | bin | 0 -> 597504 bytes | |||
-rw-r--r-- | Lib/NativeBinaries/x86/git2-eb04744.pdb | bin | 0 -> 4886528 bytes | |||
-rw-r--r-- | LibGit2Sharp.Tests/OdbBackendFixture.cs | 79 | ||||
-rw-r--r-- | LibGit2Sharp/Core/GitOdbBackend.cs | 2 | ||||
-rw-r--r-- | LibGit2Sharp/Core/GitOdbBackendStream.cs | 5 | ||||
-rw-r--r-- | LibGit2Sharp/Core/NativeDllName.cs | 2 | ||||
-rw-r--r-- | LibGit2Sharp/OdbBackend.cs | 2 | ||||
-rw-r--r-- | LibGit2Sharp/OdbBackendStream.cs | 20 | ||||
-rw-r--r-- | LibGit2Sharp/libgit2_hash.txt | 2 | ||||
m--------- | libgit2 | 0 |
16 files changed, 13 insertions, 99 deletions
diff --git a/Lib/NativeBinaries/amd64/git2-7940036.dll b/Lib/NativeBinaries/amd64/git2-7940036.dll Binary files differdeleted file mode 100644 index 0b3f720b..00000000 --- a/Lib/NativeBinaries/amd64/git2-7940036.dll +++ /dev/null diff --git a/Lib/NativeBinaries/amd64/git2-7940036.pdb b/Lib/NativeBinaries/amd64/git2-7940036.pdb Binary files differdeleted file mode 100644 index eb4d63a2..00000000 --- a/Lib/NativeBinaries/amd64/git2-7940036.pdb +++ /dev/null diff --git a/Lib/NativeBinaries/amd64/git2-eb04744.dll b/Lib/NativeBinaries/amd64/git2-eb04744.dll Binary files differnew file mode 100644 index 00000000..f186fc8f --- /dev/null +++ b/Lib/NativeBinaries/amd64/git2-eb04744.dll diff --git a/Lib/NativeBinaries/amd64/git2-eb04744.pdb b/Lib/NativeBinaries/amd64/git2-eb04744.pdb Binary files differnew file mode 100644 index 00000000..910905b1 --- /dev/null +++ b/Lib/NativeBinaries/amd64/git2-eb04744.pdb diff --git a/Lib/NativeBinaries/x86/git2-7940036.dll b/Lib/NativeBinaries/x86/git2-7940036.dll Binary files differdeleted file mode 100644 index 29af823e..00000000 --- a/Lib/NativeBinaries/x86/git2-7940036.dll +++ /dev/null diff --git a/Lib/NativeBinaries/x86/git2-7940036.pdb b/Lib/NativeBinaries/x86/git2-7940036.pdb Binary files differdeleted file mode 100644 index fad7220d..00000000 --- a/Lib/NativeBinaries/x86/git2-7940036.pdb +++ /dev/null diff --git a/Lib/NativeBinaries/x86/git2-eb04744.dll b/Lib/NativeBinaries/x86/git2-eb04744.dll Binary files differnew file mode 100644 index 00000000..4458ea2e --- /dev/null +++ b/Lib/NativeBinaries/x86/git2-eb04744.dll diff --git a/Lib/NativeBinaries/x86/git2-eb04744.pdb b/Lib/NativeBinaries/x86/git2-eb04744.pdb Binary files differnew file mode 100644 index 00000000..9777f315 --- /dev/null +++ b/Lib/NativeBinaries/x86/git2-eb04744.pdb diff --git a/LibGit2Sharp.Tests/OdbBackendFixture.cs b/LibGit2Sharp.Tests/OdbBackendFixture.cs index e8f72562..20cdf393 100644 --- a/LibGit2Sharp.Tests/OdbBackendFixture.cs +++ b/LibGit2Sharp.Tests/OdbBackendFixture.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Security.Cryptography; using System.Text; using LibGit2Sharp.Tests.TestHelpers; using Xunit; @@ -301,14 +300,6 @@ namespace LibGit2Sharp.Tests { m_type = objectType; m_length = length; - m_hash = new OdbHasher(objectType, length); - } - - protected override void Dispose() - { - m_hash.Dispose(); - - base.Dispose(); } public override bool CanRead @@ -339,16 +330,13 @@ namespace LibGit2Sharp.Tests if (bytesRead != (int)length) return GIT_ERROR; - m_hash.Update(buffer, (int)length); m_chunks.Add(buffer); return GIT_OK; } - public override int FinalizeWrite(out byte[] oid) + public override int FinalizeWrite(byte[] oid) { - oid = null; - long totalLength = m_chunks.Sum(chunk => chunk.Length); if (totalLength != m_length) @@ -356,8 +344,6 @@ namespace LibGit2Sharp.Tests return GIT_ERROR; } - oid = m_hash.RetrieveHash(); - var backend = (MockOdbBackend)Backend; if (!backend.m_objectIdToContent.ContainsKey(oid)) @@ -372,7 +358,6 @@ namespace LibGit2Sharp.Tests private readonly ObjectType m_type; private readonly long m_length; - private readonly OdbHasher m_hash; #region Unimplemented @@ -381,68 +366,6 @@ namespace LibGit2Sharp.Tests throw new NotImplementedException(); } - private class OdbHasher : IDisposable - { - private readonly HashAlgorithm hasher; - private bool hashing = true; - - public OdbHasher(ObjectType objectType, long length) - { - hasher = new SHA1CryptoServiceProvider(); - - string header = String.Format("{0} {1} ", ToHeaderFormat(objectType), length); - - byte[] buffer = Encoding.ASCII.GetBytes(header); - - buffer[buffer.Length - 1] = 0; - hasher.TransformBlock(buffer, 0, buffer.Length, null, 0); - } - - public void Update(byte[] buffer, int length) - { - if (!hashing) - { - throw new InvalidOperationException(); - } - - hasher.TransformBlock(buffer, 0, length, null, 0); - } - - public byte[] RetrieveHash() - { - hashing = false; - - hasher.TransformFinalBlock(new byte[]{}, 0, 0); - return hasher.Hash; - } - - private static string ToHeaderFormat(ObjectType type) - { - switch (type) - { - case ObjectType.Commit: - return "commit"; - - case ObjectType.Tree: - return "tree"; - - case ObjectType.Blob: - return "blob"; - - case ObjectType.Tag: - return "tag"; - - default: - throw new InvalidOperationException(String.Format("Cannot map {0} to a header format entry.", type)); - } - } - - public void Dispose() - { - ((IDisposable)hasher).Dispose(); - } - } - #endregion } diff --git a/LibGit2Sharp/Core/GitOdbBackend.cs b/LibGit2Sharp/Core/GitOdbBackend.cs index 3c1dca1e..1aaa85c6 100644 --- a/LibGit2Sharp/Core/GitOdbBackend.cs +++ b/LibGit2Sharp/Core/GitOdbBackend.cs @@ -110,8 +110,8 @@ namespace LibGit2Sharp.Core /// <param name="type">[in] The type of the object.</param> /// <returns>0 if successful; an error code otherwise.</returns> public delegate int write_callback( - ref GitOid oid, IntPtr backend, + ref GitOid oid, IntPtr data, UIntPtr len, GitObjectType type); diff --git a/LibGit2Sharp/Core/GitOdbBackendStream.cs b/LibGit2Sharp/Core/GitOdbBackendStream.cs index 12bc3553..5c5dbd18 100644 --- a/LibGit2Sharp/Core/GitOdbBackendStream.cs +++ b/LibGit2Sharp/Core/GitOdbBackendStream.cs @@ -20,6 +20,7 @@ namespace LibGit2Sharp.Core public IntPtr Backend; public GitOdbBackendStreamMode Mode; + public IntPtr HashCtx; public read_callback Read; public write_callback Write; @@ -45,8 +46,8 @@ namespace LibGit2Sharp.Core UIntPtr len); public delegate int finalize_write_callback( - out GitOid oid_p, - IntPtr stream); + IntPtr stream, + ref GitOid oid); public delegate void free_callback( IntPtr stream); diff --git a/LibGit2Sharp/Core/NativeDllName.cs b/LibGit2Sharp/Core/NativeDllName.cs index 1dfd3e67..839be4a0 100644 --- a/LibGit2Sharp/Core/NativeDllName.cs +++ b/LibGit2Sharp/Core/NativeDllName.cs @@ -2,6 +2,6 @@ namespace LibGit2Sharp.Core { internal static class NativeDllName { - public const string Name = "git2-7940036"; + public const string Name = "git2-eb04744"; } } diff --git a/LibGit2Sharp/OdbBackend.cs b/LibGit2Sharp/OdbBackend.cs index c966a582..59bdfeb3 100644 --- a/LibGit2Sharp/OdbBackend.cs +++ b/LibGit2Sharp/OdbBackend.cs @@ -381,8 +381,8 @@ namespace LibGit2Sharp } private static unsafe int Write( - ref GitOid oid, IntPtr backend, + ref GitOid oid, IntPtr data, UIntPtr len, GitObjectType type) diff --git a/LibGit2Sharp/OdbBackendStream.cs b/LibGit2Sharp/OdbBackendStream.cs index a1012f5f..2bb7b845 100644 --- a/LibGit2Sharp/OdbBackendStream.cs +++ b/LibGit2Sharp/OdbBackendStream.cs @@ -73,10 +73,10 @@ namespace LibGit2Sharp long length); /// <summary> - /// After all bytes have been written to the stream, the object ID can be retrieved by calling FinalizeWrite. + /// After all bytes have been written to the stream, the object ID is provided to FinalizeWrite. /// </summary> public abstract int FinalizeWrite( - out byte[] oid); + byte[] oid); /// <summary> /// The backend object this stream was created by. @@ -193,26 +193,16 @@ namespace LibGit2Sharp } private static int FinalizeWrite( - out GitOid oid_p, - IntPtr stream) + IntPtr stream, + ref GitOid oid) { - oid_p = default(GitOid); - OdbBackendStream odbBackendStream = GCHandle.FromIntPtr(Marshal.ReadIntPtr(stream, GitOdbBackendStream.GCHandleOffset)).Target as OdbBackendStream; if (odbBackendStream != null) { - byte[] computedObjectId; - try { - int toReturn = odbBackendStream.FinalizeWrite(out computedObjectId); - - if (0 == toReturn) - { - oid_p.Id = computedObjectId; - } - + int toReturn = odbBackendStream.FinalizeWrite(oid.Id); return toReturn; } catch (Exception ex) diff --git a/LibGit2Sharp/libgit2_hash.txt b/LibGit2Sharp/libgit2_hash.txt index d618000b..61a16f0f 100644 --- a/LibGit2Sharp/libgit2_hash.txt +++ b/LibGit2Sharp/libgit2_hash.txt @@ -1 +1 @@ -794003650e041668405a5ee12a7f763dca951758 +eb0474462170ed3198b44eb077bbb4f22cf4d74e diff --git a/libgit2 b/libgit2 -Subproject 794003650e041668405a5ee12a7f763dca95175 +Subproject eb0474462170ed3198b44eb077bbb4f22cf4d74 |