Skip to content

Commit 6eee53c

Browse files
committed
Update binaries to e93206e
libgit2/libgit2@90befde...e93206e
1 parent 7765c12 commit 6eee53c

File tree

11 files changed

+67
-14
lines changed

11 files changed

+67
-14
lines changed

LibGit2Sharp/Core/GitStrArrayOut.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Runtime.InteropServices;
4+
5+
namespace LibGit2Sharp.Core
6+
{
7+
[StructLayout(LayoutKind.Sequential)]
8+
internal class GitStrArrayOut : IDisposable
9+
{
10+
public IntPtr strings;
11+
public uint size;
12+
13+
public IEnumerable<string> Build()
14+
{
15+
int count = (int)size;
16+
var pointers = new IntPtr[count];
17+
18+
Marshal.Copy(strings, pointers, 0, count);
19+
20+
for (int i = 0; i < count; i++)
21+
{
22+
yield return LaxUtf8Marshaler.FromNative(pointers[i]);
23+
}
24+
}
25+
26+
public void Dispose()
27+
{
28+
if (size == 0)
29+
{
30+
return;
31+
}
32+
33+
var count = (int)size;
34+
35+
var pointers = new IntPtr[count];
36+
Marshal.Copy(strings, pointers, 0, count);
37+
38+
for (int i = 0; i < count; i++)
39+
{
40+
EncodingMarshaler.Cleanup(pointers[i]);
41+
}
42+
43+
Marshal.FreeHGlobal(strings);
44+
size = 0;
45+
}
46+
}
47+
}

LibGit2Sharp/Core/NativeDllName.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ namespace LibGit2Sharp.Core
22
{
33
internal static class NativeDllName
44
{
5-
public const string Name = "git2-90befde";
5+
public const string Name = "git2-e93206e";
66
}
77
}

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,9 @@ internal static extern int git_branch_remote_name(
214214

215215
[DllImport(libgit2)]
216216
internal static extern int git_remote_rename(
217+
GitStrArrayOut problems,
217218
RemoteSafeHandle remote,
218-
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string new_name,
219-
git_remote_rename_problem_cb callback,
220-
IntPtr payload);
219+
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string new_name);
221220

222221
internal delegate int git_remote_rename_problem_cb(
223222
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] string problematic_refspec,

LibGit2Sharp/Core/Proxy.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,6 @@ public static void git_remote_delete(RepositorySafeHandle repo, string name)
18301830

18311831
int res = NativeMethods.git_remote_delete(remote);
18321832
Ensure.ZeroResult(res);
1833-
remote.SetHandleAsInvalid();
18341833
}
18351834
}
18361835
}
@@ -1997,16 +1996,23 @@ public static void git_remote_rename(RepositorySafeHandle repo, string name, str
19971996

19981997
if (callback == null)
19991998
{
2000-
callback = (problem) => {};
1999+
callback = problem => {};
20012000
}
20022001

2003-
int res = NativeMethods.git_remote_rename(
2004-
remote,
2005-
new_name,
2006-
(problem, payload) => { callback(problem); return 0; },
2007-
IntPtr.Zero);
2002+
using (var array = new GitStrArrayOut())
2003+
{
2004+
int res = NativeMethods.git_remote_rename(
2005+
array,
2006+
remote,
2007+
new_name);
20082008

2009-
Ensure.ZeroResult(res);
2009+
Ensure.ZeroResult(res);
2010+
2011+
foreach (var item in array.Build ())
2012+
{
2013+
callback(item);
2014+
}
2015+
}
20102016
}
20112017
}
20122018
}

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@
318318
<Compile Include="Core\RawContentStream.cs" />
319319
<Compile Include="Core\Handles\OdbStreamSafeHandle.cs" />
320320
<Compile Include="SupportedCredentialTypes.cs" />
321+
<Compile Include="Core\GitStrArrayOut.cs" />
321322
</ItemGroup>
322323
<ItemGroup>
323324
<CodeAnalysisDictionary Include="CustomDictionary.xml" />

LibGit2Sharp/libgit2_hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
90befde4a1938641dfdb9a7bdb9f361d1de5c26f
1+
e93206e0f5bd9a1f2ad17d0d566b1e815a762420

0 commit comments

Comments
 (0)