diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2018-02-28 14:47:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-28 14:47:31 +0300 |
commit | 1a9c2acde90fc3e4da5e109e05c9265d1321e711 (patch) | |
tree | 413cc3bbed118de284ec470fe860ba7cccdb4c81 | |
parent | 2a8af3a7817a7a5a40a1fa29ee38273bdc76eef7 (diff) | |
parent | e090ca0d6d2785ef4a4e25360ff21fd7f49b566b (diff) |
Merge pull request #1505 from jianges/ExposeOfsDeltaAndStrictCreationMode
Expose enable/disable ofs delta and strict object creation settings
-rw-r--r-- | LibGit2Sharp/Core/Proxy.cs | 24 | ||||
-rw-r--r-- | LibGit2Sharp/GlobalSettings.cs | 18 |
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); + } } } |