Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bording committed Nov 28, 2024
1 parent 42ac5d2 commit 04cdfe6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
16 changes: 16 additions & 0 deletions LibGit2Sharp/Core/Handles/UnownedTreeEntryHandle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;

namespace LibGit2Sharp.Core.Handles;

internal unsafe class UnownedTreeEntryHandle : TreeEntryHandle
{
internal UnownedTreeEntryHandle()
: base(IntPtr.Zero, false)
{
}

internal UnownedTreeEntryHandle(IntPtr ptr)
: base(ptr, false)
{
}
}
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ internal static extern int git_transport_unregister(
internal static extern unsafe uint git_tree_entry_filemode(TreeEntryHandle entry);

[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe TreeEntryHandle git_tree_entry_byindex(ObjectHandle tree, UIntPtr idx);
internal static extern unsafe UnownedTreeEntryHandle git_tree_entry_byindex(ObjectHandle tree, UIntPtr idx);

[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe int git_tree_entry_bypath(
Expand Down
8 changes: 1 addition & 7 deletions LibGit2Sharp/Core/Proxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3188,13 +3188,7 @@ public static unsafe Mode git_tree_entry_attributes(TreeEntryHandle entry)

public static unsafe TreeEntryHandle git_tree_entry_byindex(ObjectHandle tree, long idx)
{
var handle = NativeMethods.git_tree_entry_byindex(tree, (UIntPtr)idx);
if (handle == null)
{
return null;
}

return new TreeEntryHandle(handle, false);
return NativeMethods.git_tree_entry_byindex(tree, (UIntPtr)idx);
}

public static unsafe TreeEntryHandle git_tree_entry_bypath(RepositoryHandle repo, ObjectId id, string treeentry_path)
Expand Down

0 comments on commit 04cdfe6

Please sign in to comment.