File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,23 @@ pub unsafe fn get_search_path(level: ConfigLevel) -> Result<CString, Error> {
69
69
buf. into_c_string ( )
70
70
}
71
71
72
+ /// Controls whether or not libgit2 will cache loaded objects. Enabled by
73
+ /// default, but disabling this can improve performance and memory usage if
74
+ /// loading a large number of objects that will not be referenced again.
75
+ /// Disabling this will cause repository objects to clear their caches when next
76
+ /// accessed.
77
+ pub fn enable_caching ( enabled : bool ) {
78
+ let error = unsafe {
79
+ raw:: git_libgit2_opts (
80
+ raw:: GIT_OPT_ENABLE_CACHING as libc:: c_int ,
81
+ enabled as libc:: c_int ,
82
+ )
83
+ } ;
84
+ // This function cannot actually fail, but the function has an error return
85
+ // for other options that can.
86
+ debug_assert ! ( error >= 0 ) ;
87
+ }
88
+
72
89
/// Controls whether or not libgit2 will verify when writing an object that all
73
90
/// objects it references are valid. Enabled by default, but disabling this can
74
91
/// significantly improve performance, at the cost of potentially allowing the
You can’t perform that action at this time.
0 commit comments