diff options
author | Russell Belfer <rb@github.com> | 2013-05-24 10:33:41 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-05-24 10:33:41 -0700 |
commit | 2e62e7c23ce69d89d495a2c42458c7e185a3120a (patch) | |
tree | 7c6c4ef783997e6d85832544689def7cf0f98897 /src/cache.c | |
parent | 0f1f9833cf13ac8714ec21fcf29d895ff8cbfe24 (diff) | |
download | libgit2-2e62e7c23ce69d89d495a2c42458c7e185a3120a.tar.gz |
Docs for git_libgit2_opts and cache disable tweak
This adds docs for the cache control options to git_libgit2_opts
and also tweaks the cache code so that if the cache is disabled,
then the next time we attempt to insert something into the cache
in question, we will actually clear any old cached objects.
Diffstat (limited to 'src/cache.c')
-rw-r--r-- | src/cache.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cache.c b/src/cache.c index 1360cc976..dc3af063a 100644 --- a/src/cache.c +++ b/src/cache.c @@ -174,6 +174,11 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry) git_cached_obj_incref(entry); + if (!git_cache__enabled && cache->used_memory > 0) { + git_cache_clear(cache); + return entry; + } + if (!cache_should_store(entry->type, entry->size)) return entry; |