8 struct cache_tree_sub
{
9 struct cache_tree
*cache_tree
;
10 int count
; /* internally used by update_one() */
13 char name
[FLEX_ARRAY
];
17 int entry_count
; /* negative means "invalid" */
18 unsigned char sha1
[20];
21 struct cache_tree_sub
**down
;
24 struct cache_tree
*cache_tree(void);
25 void cache_tree_free(struct cache_tree
**);
26 void cache_tree_invalidate_path(struct cache_tree
*, const char *);
27 struct cache_tree_sub
*cache_tree_sub(struct cache_tree
*, const char *);
29 void cache_tree_write(struct strbuf
*, struct cache_tree
*root
);
30 struct cache_tree
*cache_tree_read(const char *buffer
, unsigned long size
);
32 int cache_tree_fully_valid(struct cache_tree
*);
33 int cache_tree_update(struct cache_tree
*, const struct cache_entry
* const *, int, int);
35 int update_main_cache_tree(int);
37 /* bitmasks to write_cache_as_tree flags */
38 #define WRITE_TREE_MISSING_OK 1
39 #define WRITE_TREE_IGNORE_CACHE_TREE 2
40 #define WRITE_TREE_DRY_RUN 4
41 #define WRITE_TREE_SILENT 8
42 #define WRITE_TREE_REPAIR 16
44 /* error return codes */
45 #define WRITE_TREE_UNREADABLE_INDEX (-1)
46 #define WRITE_TREE_UNMERGED_INDEX (-2)
47 #define WRITE_TREE_PREFIX_ERROR (-3)
49 int write_cache_as_tree(unsigned char *sha1
, int flags
, const char *prefix
);
50 void prime_cache_tree(struct cache_tree
**, struct tree
*);
52 extern int cache_tree_matches_traversal(struct cache_tree
*, struct name_entry
*ent
, struct traverse_info
*info
);