diff options
| author | Michael Schubert <schu@schu.io> | 2013-03-25 13:38:43 +0100 |
|---|---|---|
| committer | Michael Schubert <schu@schu.io> | 2013-03-25 15:45:56 +0100 |
| commit | f5e28202cb8d73a444e5a5664420fbe5bec11119 (patch) | |
| tree | 7e70d1ef6f84451252234097255a0321a21073e2 /src/odb.c | |
| parent | 3f21a23cc26cc6fbf84122872acf833de2a287e0 (diff) | |
| download | libgit2-f5e28202cb8d73a444e5a5664420fbe5bec11119.tar.gz | |
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/odb.c')
| -rw-r--r-- | src/odb.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -32,6 +32,8 @@ typedef struct int is_alternate; } backend_internal; +size_t git_odb__cache_size = GIT_DEFAULT_CACHE_SIZE; + static int load_alternates(git_odb *odb, const char *objects_dir, int alternate_depth); int git_odb__format_object_header(char *hdr, size_t n, size_t obj_len, git_otype obj_type) @@ -351,7 +353,7 @@ int git_odb_new(git_odb **out) git_odb *db = git__calloc(1, sizeof(*db)); GITERR_CHECK_ALLOC(db); - if (git_cache_init(&db->cache, GIT_DEFAULT_CACHE_SIZE, &free_odb_object) < 0 || + if (git_cache_init(&db->cache, git_odb__cache_size, &free_odb_object) < 0 || git_vector_init(&db->backends, 4, backend_sort_cmp) < 0) { git__free(db); |
