1#ifndef CACHE_TREE_H
2#define CACHE_TREE_H
34
struct cache_tree;
5struct cache_tree_sub {
6struct cache_tree *cache_tree;
7int namelen;
8int used;
9char name[FLEX_ARRAY];
10};
1112
struct cache_tree {
13int entry_count; /* negative means "invalid" */
14unsigned char sha1[20];
15int subtree_nr;
16int subtree_alloc;
17struct cache_tree_sub **down;
18};
1920
struct cache_tree *cache_tree(void);
21void cache_tree_free(struct cache_tree **);
22void cache_tree_invalidate_path(struct cache_tree *, const char *);
23struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
2425
void cache_tree_write(struct strbuf *, struct cache_tree *root);
26struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
2728
int cache_tree_fully_valid(struct cache_tree *);
29int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int);
3031
struct cache_tree *cache_tree_find(struct cache_tree *, const char *);
3233
#define WRITE_TREE_UNREADABLE_INDEX (-1)
34#define WRITE_TREE_UNMERGED_INDEX (-2)
35#define WRITE_TREE_PREFIX_ERROR (-3)
3637
int write_cache_as_tree(unsigned char *sha1, int missing_ok, const char *prefix);
38#endif