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:
authoryorah <yoram.harmelin@gmail.com>2012-04-28 20:18:30 +0400
committernulltoken <emeric.fermas@gmail.com>2012-05-22 21:24:46 +0400
commita400fa557ccddc40cbaa87c64210ae68ac941d6d (patch)
tree87f1c73afe3b391b39f3670063a5f79e93b49488 /LibGit2Sharp
parenta3af35d0a4a1953c436d140b9dc5b2d64c9ed387 (diff)
Marshal the libgit2 note functions
Diffstat (limited to 'LibGit2Sharp')
-rw-r--r--LibGit2Sharp/Core/GitNoteData.cs11
-rw-r--r--LibGit2Sharp/Core/Handles/NoteSafeHandle.cs11
-rw-r--r--LibGit2Sharp/Core/NativeMethods.cs51
-rw-r--r--LibGit2Sharp/LibGit2Sharp.csproj2
4 files changed, 75 insertions, 0 deletions
diff --git a/LibGit2Sharp/Core/GitNoteData.cs b/LibGit2Sharp/Core/GitNoteData.cs
new file mode 100644
index 00000000..6592ab8c
--- /dev/null
+++ b/LibGit2Sharp/Core/GitNoteData.cs
@@ -0,0 +1,11 @@
+using System.Runtime.InteropServices;
+
+namespace LibGit2Sharp.Core
+{
+ [StructLayout(LayoutKind.Sequential)]
+ internal class GitNoteData
+ {
+ public GitOid BlobOid;
+ public GitOid TargetOid;
+ }
+}
diff --git a/LibGit2Sharp/Core/Handles/NoteSafeHandle.cs b/LibGit2Sharp/Core/Handles/NoteSafeHandle.cs
new file mode 100644
index 00000000..22e8fcff
--- /dev/null
+++ b/LibGit2Sharp/Core/Handles/NoteSafeHandle.cs
@@ -0,0 +1,11 @@
+namespace LibGit2Sharp.Core.Handles
+{
+ internal class NoteSafeHandle : SafeHandleBase
+ {
+ protected override bool ReleaseHandle()
+ {
+ NativeMethods.git_note_free(handle);
+ return true;
+ }
+ }
+}
diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs
index ffe53751..a6b9bb3e 100644
--- a/LibGit2Sharp/Core/NativeMethods.cs
+++ b/LibGit2Sharp/Core/NativeMethods.cs
@@ -340,6 +340,57 @@ namespace LibGit2Sharp.Core
GitObjectSafeHandle two);
[DllImport(libgit2)]
+ public static extern int git_note_create(
+ out GitOid noteOid,
+ RepositorySafeHandle repo,
+ SignatureSafeHandle author,
+ SignatureSafeHandle committer,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
+ ref GitOid oid,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string note);
+
+ [DllImport(libgit2)]
+ public static extern void git_note_free(IntPtr note);
+
+ [DllImport(libgit2)]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]
+ public static extern string git_note_message(NoteSafeHandle note);
+
+ [DllImport(libgit2)]
+ public static extern OidSafeHandle git_note_oid(NoteSafeHandle note);
+
+ [DllImport(libgit2)]
+ public static extern int git_note_read(
+ out NoteSafeHandle note,
+ RepositorySafeHandle repo,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
+ ref GitOid oid);
+
+ [DllImport(libgit2)]
+ public static extern int git_note_remove(
+ RepositorySafeHandle repo,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
+ SignatureSafeHandle author,
+ SignatureSafeHandle committer,
+ ref GitOid oid);
+
+ [DllImport(libgit2)]
+ public static extern int git_note_default_ref(
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] out string notes_ref,
+ RepositorySafeHandle repo);
+
+ internal delegate int notes_foreach_callback(
+ GitNoteData noteData,
+ IntPtr payload);
+
+ [DllImport(libgit2)]
+ public static extern int git_note_foreach(
+ RepositorySafeHandle repo,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
+ notes_foreach_callback callback,
+ IntPtr payload);
+
+ [DllImport(libgit2)]
public static extern int git_odb_exists(ObjectDatabaseSafeHandle odb, ref GitOid id);
[DllImport(libgit2)]
diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj
index fc6bbd76..b6b79caf 100644
--- a/LibGit2Sharp/LibGit2Sharp.csproj
+++ b/LibGit2Sharp/LibGit2Sharp.csproj
@@ -62,8 +62,10 @@
<Compile Include="Core\GitBranchType.cs" />
<Compile Include="Core\GitDiff.cs" />
<Compile Include="Core\GitError.cs" />
+ <Compile Include="Core\GitNoteData.cs" />
<Compile Include="Core\GitObjectExtensions.cs" />
<Compile Include="Core\Handles\GitErrorSafeHandle.cs" />
+ <Compile Include="Core\Handles\NoteSafeHandle.cs" />
<Compile Include="Core\Handles\ObjectDatabaseSafeHandle.cs" />
<Compile Include="Core\Handles\DiffListSafeHandle.cs" />
<Compile Include="Core\Handles\GitObjectSafeHandle.cs" />