| 1 |
|
| 2 |
|
| 3 |
#ifndef CACHE_TREE_H |
| 4 |
#define CACHE_TREE_H |
| 5 |
|
| 6 |
#include "tree.h" |
| 7 |
#include "tree-walk.h" |
| 8 |
|
| 9 |
struct cache_tree; |
| 10 |
struct cache_tree_sub { |
| 11 |
struct cache_tree *cache_tree; |
| 12 |
int namelen; |
| 13 |
int used; |
| 14 |
char name[FLEX_ARRAY]; |
| 15 |
}; |
| 16 |
|
| 17 |
struct cache_tree { |
| 18 |
int entry_count; |
| 19 |
unsigned char sha1[20]; |
| 20 |
int subtree_nr; |
| 21 |
int subtree_alloc; |
| 22 |
struct cache_tree_sub **down; |
| 23 |
}; |
| 24 |
|
| 25 |
|
| 26 |
extern struct cache_tree global_cache_tree; |
| 27 |
|
| 28 |
struct cache_tree *cache_tree(void); |
| 29 |
extern void cache_tree_free(struct cache_tree **); |
| 30 |
void cache_tree_invalidate_path(struct cache_tree *, const char *); |
| 31 |
struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *); |
| 32 |
|
| 33 |
void cache_tree_write(struct strbuf *, struct cache_tree *root); |
| 34 |
struct cache_tree *cache_tree_read(const char *buffer, unsigned long size); |
| 35 |
|
| 36 |
int cache_tree_fully_valid(struct cache_tree *); |
| 37 |
int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int); |
| 38 |
|
| 39 |
|
| 40 |
#define WRITE_TREE_MISSING_OK 1 |
| 41 |
#define WRITE_TREE_IGNORE_CACHE_TREE 2 |
| 42 |
|
| 43 |
|
| 44 |
#define WRITE_TREE_UNREADABLE_INDEX (-1) |
| 45 |
#define WRITE_TREE_UNMERGED_INDEX (-2) |
| 46 |
#define WRITE_TREE_PREFIX_ERROR (-3) |
| 47 |
|
| 48 |
int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix); |
| 49 |
void prime_cache_tree(struct cache_tree **, struct tree *); |
| 50 |
|
| 51 |
extern int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info); |
| 52 |
|
| 53 |
#endif |