summaryrefslogtreecommitdiff
path: root/src/tree-cache.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-09-28 07:00:49 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-10-10 19:43:42 +0200
commitc2f8b215937ed6f17dce94a4bde26d5c83b42533 (patch)
treea8ec9796153969a8b857430fc1c04061026a731a /src/tree-cache.h
parent46bb00673013a7dae1ee81c484ac05c533ed1c4d (diff)
downloadlibgit2-c2f8b215937ed6f17dce94a4bde26d5c83b42533.tar.gz
index: write out the tree cache extension
Keeping the cache around after read-tree is only one part of the optimisation opportunities. In order to share the cache between program instances, we need to write the TREE extension to the index. Do so, taking the opportunity to rename 'entries' to 'entry_count' to match the name given in the format description. The included test is rather trivial, but works as a sanity check.
Diffstat (limited to 'src/tree-cache.h')
-rw-r--r--src/tree-cache.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tree-cache.h b/src/tree-cache.h
index b92a401a6..c44ca7cf5 100644
--- a/src/tree-cache.h
+++ b/src/tree-cache.h
@@ -10,18 +10,20 @@
#include "common.h"
#include "pool.h"
+#include "buffer.h"
#include "git2/oid.h"
typedef struct git_tree_cache {
struct git_tree_cache **children;
size_t children_count;
- ssize_t entries;
+ ssize_t entry_count;
git_oid oid;
size_t namelen;
char name[GIT_FLEX_ARRAY];
} git_tree_cache;
+int git_tree_cache_write(git_buf *out, git_tree_cache *tree);
int git_tree_cache_read(git_tree_cache **tree, const char *buffer, size_t buffer_size, git_pool *pool);
void git_tree_cache_invalidate_path(git_tree_cache *tree, const char *path);
const git_tree_cache *git_tree_cache_get(const git_tree_cache *tree, const char *path);