]>
Commit | Line | Data |
---|---|---|
74986462 JH |
1 | #ifndef CACHE_TREE_H |
2 | #define CACHE_TREE_H | |
3 | ||
b9d37a54 | 4 | #include "tree.h" |
b65982b6 | 5 | #include "tree-walk.h" |
b9d37a54 | 6 | |
74986462 JH |
7 | struct cache_tree; |
8 | struct cache_tree_sub { | |
9 | struct cache_tree *cache_tree; | |
3cf773e4 | 10 | int count; /* internally used by update_one() */ |
74986462 JH |
11 | int namelen; |
12 | int used; | |
13 | char name[FLEX_ARRAY]; | |
14 | }; | |
15 | ||
16 | struct cache_tree { | |
17 | int entry_count; /* negative means "invalid" */ | |
e0a92804 | 18 | struct object_id oid; |
74986462 JH |
19 | int subtree_nr; |
20 | int subtree_alloc; | |
21 | struct cache_tree_sub **down; | |
22 | }; | |
23 | ||
24 | struct cache_tree *cache_tree(void); | |
bad68ec9 | 25 | void cache_tree_free(struct cache_tree **); |
a5400efe | 26 | void cache_tree_invalidate_path(struct index_state *, const char *); |
7927a55d | 27 | struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *); |
74986462 | 28 | |
c80dd396 DS |
29 | int cache_tree_subtree_pos(struct cache_tree *it, const char *path, int pathlen); |
30 | ||
1dffb8fa | 31 | void cache_tree_write(struct strbuf *, struct cache_tree *root); |
bad68ec9 | 32 | struct cache_tree *cache_tree_read(const char *buffer, unsigned long size); |
74986462 | 33 | |
bad68ec9 | 34 | int cache_tree_fully_valid(struct cache_tree *); |
d0cfc3e8 | 35 | int cache_tree_update(struct index_state *, int); |
c207e9e1 | 36 | void cache_tree_verify(struct repository *, struct index_state *); |
996277c5 | 37 | |
724dd767 | 38 | /* bitmasks to write_index_as_tree flags */ |
d11b8d34 JH |
39 | #define WRITE_TREE_MISSING_OK 1 |
40 | #define WRITE_TREE_IGNORE_CACHE_TREE 2 | |
e859c69b NTND |
41 | #define WRITE_TREE_DRY_RUN 4 |
42 | #define WRITE_TREE_SILENT 8 | |
aecf567c | 43 | #define WRITE_TREE_REPAIR 16 |
d11b8d34 JH |
44 | |
45 | /* error return codes */ | |
45525bd0 JH |
46 | #define WRITE_TREE_UNREADABLE_INDEX (-1) |
47 | #define WRITE_TREE_UNMERGED_INDEX (-2) | |
48 | #define WRITE_TREE_PREFIX_ERROR (-3) | |
49 | ||
724dd767 | 50 | struct tree* write_in_core_index_as_tree(struct repository *repo); |
fc5cb99f | 51 | int write_index_as_tree(struct object_id *oid, struct index_state *index_state, const char *index_path, int flags, const char *prefix); |
c207e9e1 | 52 | void prime_cache_tree(struct repository *, struct index_state *, struct tree *); |
b9d37a54 | 53 | |
9ab34f9e | 54 | int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info); |
74986462 | 55 | #endif |