Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schubert <schu@schu.io>2013-03-25 16:38:43 +0400
committerMichael Schubert <schu@schu.io>2013-03-25 18:45:56 +0400
commitf5e28202cb8d73a444e5a5664420fbe5bec11119 (patch)
tree7e70d1ef6f84451252234097255a0321a21073e2 /src/util.c
parent3f21a23cc26cc6fbf84122872acf833de2a287e0 (diff)
opts: allow configuration of odb cache size
Currently, the odb cache has a fixed size of 128 slots as defined by GIT_DEFAULT_CACHE_SIZE. Allow users to set the size of the cache via git_libgit2_opts(). Fixes #1035.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index f5b4a1d68..44ac1af73 100644
--- a/src/util.c
+++ b/src/util.c
@@ -38,6 +38,7 @@ int git_libgit2_capabilities()
/* Declarations for tuneable settings */
extern size_t git_mwindow__window_size;
extern size_t git_mwindow__mapped_limit;
+extern size_t git_odb__cache_size;
static int config_level_to_futils_dir(int config_level)
{
@@ -92,6 +93,14 @@ int git_libgit2_opts(int key, ...)
if ((error = config_level_to_futils_dir(va_arg(ap, int))) >= 0)
error = git_futils_dirs_set(error, va_arg(ap, const char *));
break;
+
+ case GIT_OPT_GET_ODB_CACHE_SIZE:
+ *(va_arg(ap, size_t *)) = git_odb__cache_size;
+ break;
+
+ case GIT_OPT_SET_ODB_CACHE_SIZE:
+ git_odb__cache_size = va_arg(ap, size_t);
+ break;
}
va_end(ap);