Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUngureanu Marius <marius.ungureanu@xamarin.com>2014-06-13 04:40:15 +0400
committerMarius Ungureanu <marius.ungureanu@xamarin.com>2014-06-14 16:10:14 +0400
commit6eee53c02f0eb5019f6ae7b489dc34586013ca27 (patch)
treece1e21ccd9dad705c2e5b143b00100ff29a387fe /LibGit2Sharp
parent7765c12cf3315a0d8c3d28f61a261510abf348e2 (diff)
Update binaries to e93206e
https://github.com/libgit2/libgit2/compare/90befde...e93206e
Diffstat (limited to 'LibGit2Sharp')
-rw-r--r--LibGit2Sharp/Core/GitStrArrayOut.cs47
-rw-r--r--LibGit2Sharp/Core/NativeDllName.cs2
-rw-r--r--LibGit2Sharp/Core/NativeMethods.cs5
-rw-r--r--LibGit2Sharp/Core/Proxy.cs22
-rw-r--r--LibGit2Sharp/LibGit2Sharp.csproj1
-rw-r--r--LibGit2Sharp/libgit2_hash.txt2
6 files changed, 66 insertions, 13 deletions
diff --git a/LibGit2Sharp/Core/GitStrArrayOut.cs b/LibGit2Sharp/Core/GitStrArrayOut.cs
new file mode 100644
index 00000000..0bc2f676
--- /dev/null
+++ b/LibGit2Sharp/Core/GitStrArrayOut.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+namespace LibGit2Sharp.Core
+{
+ [StructLayout(LayoutKind.Sequential)]
+ internal class GitStrArrayOut : IDisposable
+ {
+ public IntPtr strings;
+ public uint size;
+
+ public IEnumerable<string> Build()
+ {
+ int count = (int)size;
+ var pointers = new IntPtr[count];
+
+ Marshal.Copy(strings, pointers, 0, count);
+
+ for (int i = 0; i < count; i++)
+ {
+ yield return LaxUtf8Marshaler.FromNative(pointers[i]);
+ }
+ }
+
+ public void Dispose()
+ {
+ if (size == 0)
+ {
+ return;
+ }
+
+ var count = (int)size;
+
+ var pointers = new IntPtr[count];
+ Marshal.Copy(strings, pointers, 0, count);
+
+ for (int i = 0; i < count; i++)
+ {
+ EncodingMarshaler.Cleanup(pointers[i]);
+ }
+
+ Marshal.FreeHGlobal(strings);
+ size = 0;
+ }
+ }
+}
diff --git a/LibGit2Sharp/Core/NativeDllName.cs b/LibGit2Sharp/Core/NativeDllName.cs
index 5fd4f2b5..d68324d8 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-90befde";
+ public const string Name = "git2-e93206e";
}
}
diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs
index 55bbe19a..9b06c60f 100644
--- a/LibGit2Sharp/Core/NativeMethods.cs
+++ b/LibGit2Sharp/Core/NativeMethods.cs
@@ -214,10 +214,9 @@ namespace LibGit2Sharp.Core
[DllImport(libgit2)]
internal static extern int git_remote_rename(
+ GitStrArrayOut problems,
RemoteSafeHandle remote,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string new_name,
- git_remote_rename_problem_cb callback,
- IntPtr payload);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string new_name);
internal delegate int git_remote_rename_problem_cb(
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] string problematic_refspec,
diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs
index 3b1cc029..096b0282 100644
--- a/LibGit2Sharp/Core/Proxy.cs
+++ b/LibGit2Sharp/Core/Proxy.cs
@@ -1830,7 +1830,6 @@ namespace LibGit2Sharp.Core
int res = NativeMethods.git_remote_delete(remote);
Ensure.ZeroResult(res);
- remote.SetHandleAsInvalid();
}
}
}
@@ -1997,16 +1996,23 @@ namespace LibGit2Sharp.Core
if (callback == null)
{
- callback = (problem) => {};
+ callback = problem => {};
}
- int res = NativeMethods.git_remote_rename(
- remote,
- new_name,
- (problem, payload) => { callback(problem); return 0; },
- IntPtr.Zero);
+ using (var array = new GitStrArrayOut())
+ {
+ int res = NativeMethods.git_remote_rename(
+ array,
+ remote,
+ new_name);
- Ensure.ZeroResult(res);
+ Ensure.ZeroResult(res);
+
+ foreach (var item in array.Build ())
+ {
+ callback(item);
+ }
+ }
}
}
}
diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj
index 85e12cd2..869f5d02 100644
--- a/LibGit2Sharp/LibGit2Sharp.csproj
+++ b/LibGit2Sharp/LibGit2Sharp.csproj
@@ -318,6 +318,7 @@
<Compile Include="Core\RawContentStream.cs" />
<Compile Include="Core\Handles\OdbStreamSafeHandle.cs" />
<Compile Include="SupportedCredentialTypes.cs" />
+ <Compile Include="Core\GitStrArrayOut.cs" />
</ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="CustomDictionary.xml" />
diff --git a/LibGit2Sharp/libgit2_hash.txt b/LibGit2Sharp/libgit2_hash.txt
index 44e16bb2..69a9bd0a 100644
--- a/LibGit2Sharp/libgit2_hash.txt
+++ b/LibGit2Sharp/libgit2_hash.txt
@@ -1 +1 @@
-90befde4a1938641dfdb9a7bdb9f361d1de5c26f
+e93206e0f5bd9a1f2ad17d0d566b1e815a762420