From 8165fe285c074fcd68f08a1daeeb77da176d1477 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Sun, 10 Feb 2013 20:06:03 -0600 Subject: [PATCH] move conflicts to reuc when removing index entries --- LibGit2Sharp/Core/NativeMethods.cs | 5 +++++ LibGit2Sharp/Core/Proxy.cs | 9 +++++++++ LibGit2Sharp/Index.cs | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs index a9ead15f2..c67d66c4a 100644 --- a/LibGit2Sharp/Core/NativeMethods.cs +++ b/LibGit2Sharp/Core/NativeMethods.cs @@ -460,6 +460,11 @@ internal static extern int git_index_remove( [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path, int stage); + [DllImport(libgit2)] + internal static extern int git_index_remove_bypath( + IndexSafeHandle index, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path); + [DllImport(libgit2)] internal static extern int git_index_write(IndexSafeHandle index); diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs index 7e891d30c..9042ab1a8 100644 --- a/LibGit2Sharp/Core/Proxy.cs +++ b/LibGit2Sharp/Core/Proxy.cs @@ -778,6 +778,15 @@ public static void git_index_remove(IndexSafeHandle index, FilePath path, int st } } + public static void git_index_remove_bypath(IndexSafeHandle index, FilePath path) + { + using (ThreadAffinity()) + { + int res = NativeMethods.git_index_remove_bypath(index, path); + Ensure.ZeroResult(res); + } + } + public static void git_index_write(IndexSafeHandle index) { using (ThreadAffinity()) diff --git a/LibGit2Sharp/Index.cs b/LibGit2Sharp/Index.cs index baa909def..f5d698075 100644 --- a/LibGit2Sharp/Index.cs +++ b/LibGit2Sharp/Index.cs @@ -427,7 +427,7 @@ private void AddToIndex(string relativePath) private void RemoveFromIndex(string relativePath) { - Proxy.git_index_remove(handle, relativePath, 0); + Proxy.git_index_remove_bypath(handle, relativePath); } private void UpdatePhysicalIndex()