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:
authorEdward Thomson <ethomson@edwardthomson.com>2018-02-28 14:47:31 +0300
committerGitHub <noreply@github.com>2018-02-28 14:47:31 +0300
commit1a9c2acde90fc3e4da5e109e05c9265d1321e711 (patch)
tree413cc3bbed118de284ec470fe860ba7cccdb4c81
parent2a8af3a7817a7a5a40a1fa29ee38273bdc76eef7 (diff)
parente090ca0d6d2785ef4a4e25360ff21fd7f49b566b (diff)
Merge pull request #1505 from jianges/ExposeOfsDeltaAndStrictCreationMode
Expose enable/disable ofs delta and strict object creation settings
-rw-r--r--LibGit2Sharp/Core/Proxy.cs24
-rw-r--r--LibGit2Sharp/GlobalSettings.cs18
2 files changed, 41 insertions, 1 deletions
diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs
index 02ae4a1c..6bef3b6b 100644
--- a/LibGit2Sharp/Core/Proxy.cs
+++ b/LibGit2Sharp/Core/Proxy.cs
@@ -3424,7 +3424,29 @@ namespace LibGit2Sharp.Core
Ensure.ZeroResult(res);
}
-#endregion
+ /// <summary>
+ /// Enable or disable the ofs_delta capabilty
+ /// </summary>
+ /// <param name="enabled">true to enable the ofs_delta capabilty, false otherwise</param>
+ public static void git_libgit2_opts_set_enable_ofsdelta(bool enabled)
+ {
+ // libgit2 expects non-zero value for true
+ var res = NativeMethods.git_libgit2_opts((int)LibGit2Option.EnableOfsDelta, enabled ? 1 : 0);
+ Ensure.ZeroResult(res);
+ }
+
+ /// <summary>
+ /// Enable or disable the strict_object_creation capabilty
+ /// </summary>
+ /// <param name="enabled">true to enable the strict_object_creation capabilty, false otherwise</param>
+ public static void git_libgit2_opts_set_enable_strictobjectcreation(bool enabled)
+ {
+ // libgit2 expects non-zero value for true
+ var res = NativeMethods.git_libgit2_opts((int)LibGit2Option.EnableStrictObjectCreation, enabled ? 1 : 0);
+ Ensure.ZeroResult(res);
+ }
+
+ #endregion
private static ICollection<TResult> git_foreach<T, TResult>(
Func<T, TResult> resultSelector,
diff --git a/LibGit2Sharp/GlobalSettings.cs b/LibGit2Sharp/GlobalSettings.cs
index 3868a671..c953a7b0 100644
--- a/LibGit2Sharp/GlobalSettings.cs
+++ b/LibGit2Sharp/GlobalSettings.cs
@@ -334,5 +334,23 @@ namespace LibGit2Sharp
{
Proxy.git_libgit2_opts_set_enable_caching(enabled);
}
+
+ /// <summary>
+ /// Enable or disable the ofs_delta capability
+ /// </summary>
+ /// <param name="enabled">true to enable the ofs_delta capability, false otherwise</param>
+ public static void SetEnableOfsDelta(bool enabled)
+ {
+ Proxy.git_libgit2_opts_set_enable_ofsdelta(enabled);
+ }
+
+ /// <summary>
+ /// Enable or disable the libgit2 strict_object_creation capability
+ /// </summary>
+ /// <param name="enabled">true to enable the strict_object_creation capability, false otherwise</param>
+ public static void SetEnableStrictObjectCreation(bool enabled)
+ {
+ Proxy.git_libgit2_opts_set_enable_strictobjectcreation(enabled);
+ }
}
}