Skip to content

Update binaries to e93206e #762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
47 changes: 47 additions & 0 deletions LibGit2Sharp/Core/GitStrArrayOut.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/NativeDllName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace LibGit2Sharp.Core
{
internal static class NativeDllName
{
public const string Name = "git2-90befde";
public const string Name = "git2-e93206e";
}
}
5 changes: 2 additions & 3 deletions LibGit2Sharp/Core/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,9 @@ internal static extern int git_branch_remote_name(

[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,
Expand Down
22 changes: 14 additions & 8 deletions LibGit2Sharp/Core/Proxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,6 @@ public static void git_remote_delete(RepositorySafeHandle repo, string name)

int res = NativeMethods.git_remote_delete(remote);
Ensure.ZeroResult(res);
remote.SetHandleAsInvalid();
}
}
}
Expand Down Expand Up @@ -1997,16 +1996,23 @@ public static void git_remote_rename(RepositorySafeHandle repo, string name, str

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);
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions LibGit2Sharp/LibGit2Sharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/libgit2_hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
90befde4a1938641dfdb9a7bdb9f361d1de5c26f
e93206e0f5bd9a1f2ad17d0d566b1e815a762420