Skip to content

Commit 72fa368

Browse files
committed
Merge branch 'pr/1352'
2 parents e8ca4e8 + 9cf43a3 commit 72fa368

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

LibGit2Sharp/Core/Proxy.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,6 +3418,17 @@ public static void git_libgit2_opts_set_search_path(ConfigurationLevel level, st
34183418
Ensure.ZeroResult(res);
34193419
}
34203420

3421+
/// <summary>
3422+
/// Enable or disable the libgit2 cache
3423+
/// </summary>
3424+
/// <param name="enabled">true to enable the cache, false otherwise</param>
3425+
public static void git_libgit2_opts_set_enable_caching(bool enabled)
3426+
{
3427+
// libgit2 expects non-zero value for true
3428+
var res = NativeMethods.git_libgit2_opts((int)LibGitOption.EnableCaching, enabled ? 1 : 0);
3429+
Ensure.ZeroResult(res);
3430+
}
3431+
34213432
#endregion
34223433

34233434
private static ICollection<TResult> git_foreach<T, TResult>(

LibGit2Sharp/GlobalSettings.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,5 +329,14 @@ public static void SetStrictHashVerification(bool enabled)
329329
{
330330
Proxy.git_libgit2_opts_enable_strict_hash_verification(enabled);
331331
}
332+
333+
/// <summary>
334+
/// Enable or disable the libgit2 cache
335+
/// </summary>
336+
/// <param name="enabled">true to enable the cache, false otherwise</param>
337+
public static void SetEnableCaching(bool enabled)
338+
{
339+
Proxy.git_libgit2_opts_set_enable_caching(enabled);
340+
}
332341
}
333342
}

0 commit comments

Comments
 (0)