1#ifndef CACHE_TREE_H
2#define CACHE_TREE_H
3
4#include "tree.h"
5
6struct cache_tree;
7struct cache_tree_sub {
8 struct cache_tree *cache_tree;
9 int namelen;
10 int used;
11 char name[FLEX_ARRAY];
12};
13
14struct cache_tree {
15 int entry_count; /* negative means "invalid" */
16 unsigned char sha1[20];
17 int subtree_nr;
18 int subtree_alloc;
19 struct cache_tree_sub **down;
20};
21
22struct cache_tree *cache_tree(void);
23void cache_tree_free(struct cache_tree **);
24void cache_tree_invalidate_path(struct cache_tree *, const char *);
25struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
26
27void cache_tree_write(struct strbuf *, struct cache_tree *root);
28struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
29
30int cache_tree_fully_valid(struct cache_tree *);
31int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int);
32
33#define WRITE_TREE_UNREADABLE_INDEX (-1)
34#define WRITE_TREE_UNMERGED_INDEX (-2)
35#define WRITE_TREE_PREFIX_ERROR (-3)
36
37int write_cache_as_tree(unsigned char *sha1, int missing_ok, const char *prefix);
38void prime_cache_tree(struct cache_tree **, struct tree *);
39
40#endif