Skip to content

Commit 01a3711

Browse files
committed
WIP
1 parent 04cdfe6 commit 01a3711

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

LibGit2Sharp/BlameHunk.cs

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Diagnostics;
33
using System.Globalization;
44
using LibGit2Sharp.Core;
5+
using LibGit2Sharp.Core.Handles;
56

67
namespace LibGit2Sharp
78
{
@@ -42,12 +43,18 @@ internal unsafe BlameHunk(IRepository repository, git_blame_hunk* rawHunk)
4243
// Signature objects need to have ownership of their native pointers
4344
if (rawHunk->final_signature != null)
4445
{
45-
FinalSignature = new Signature(rawHunk->final_signature);
46+
var ptr = new IntPtr(rawHunk->final_signature);
47+
var signatureHandle = new SignatureHandle(ptr, false);
48+
49+
FinalSignature = new Signature(signatureHandle);
4650
}
4751

4852
if (rawHunk->orig_signature != null)
4953
{
50-
InitialSignature = new Signature(rawHunk->orig_signature);
54+
var ptr = new IntPtr(rawHunk->orig_signature);
55+
var signatureHandle = new SignatureHandle(ptr, false);
56+
57+
InitialSignature = new Signature(signatureHandle);
5158
}
5259
}
5360

LibGit2Sharp/Core/NativeMethods.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ internal static extern int git_error_set_str(
182182
internal static extern unsafe uint git_blame_get_hunk_count(BlameHandle blame);
183183

184184
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
185-
internal static extern unsafe git_blame_hunk* git_blame_get_hunk_byindex(
186-
BlameHandle blame, uint index);
185+
internal static extern unsafe git_blame_hunk* git_blame_get_hunk_byindex(BlameHandle blame, uint index);
187186

188187
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
189188
internal static extern unsafe int git_blame_file(

LibGit2Sharp/FilterSource.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ internal unsafe FilterSource(FilePath path, FilterMode mode, git_filter_source*
1818
SourceMode = mode;
1919
ObjectId = ObjectId.BuildFromPtr(&source->oid);
2020
Path = path.Native;
21-
Root = Proxy.git_repository_workdir(new IntPtr(source->repository)).Native;
21+
22+
Root = Proxy.git_repository_workdir(source->repository).Native;
2223
}
2324

2425
/// <summary>
25-
/// Take an unmanaged pointer and convert it to filter source callback paramater
26+
/// Take an unmanaged pointer and convert it to filter source callback parameter.
2627
/// </summary>
2728
/// <param name="ptr"></param>
2829
/// <returns></returns>
@@ -32,7 +33,7 @@ internal static unsafe FilterSource FromNativePtr(IntPtr ptr)
3233
}
3334

3435
/// <summary>
35-
/// Take an unmanaged pointer and convert it to filter source callback paramater
36+
/// Take an unmanaged pointer and convert it to filter source callback parameter.
3637
/// </summary>
3738
/// <param name="ptr"></param>
3839
/// <returns></returns>

0 commit comments

Comments
 (0)