Test the current state of the cache-tree optimization
[git/git.git] / cache-tree.h
CommitLineData
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
7struct cache_tree;
8struct cache_tree_sub {
9 struct cache_tree *cache_tree;
10 int namelen;
11 int used;
12 char name[FLEX_ARRAY];
13};
14
15struct cache_tree {
16 int entry_count; /* negative means "invalid" */
17 unsigned char sha1[20];
18 int subtree_nr;
19 int subtree_alloc;
20 struct cache_tree_sub **down;
21};
22
23struct cache_tree *cache_tree(void);
bad68ec9 24void cache_tree_free(struct cache_tree **);
74986462 25void cache_tree_invalidate_path(struct cache_tree *, const char *);
7927a55d 26struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
74986462 27
1dffb8fa 28void cache_tree_write(struct strbuf *, struct cache_tree *root);
bad68ec9 29struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
74986462 30
bad68ec9 31int cache_tree_fully_valid(struct cache_tree *);
2956dd3b 32int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int);
74986462 33
d11b8d34
JH
34/* bitmasks to write_cache_as_tree flags */
35#define WRITE_TREE_MISSING_OK 1
36#define WRITE_TREE_IGNORE_CACHE_TREE 2
37
38/* error return codes */
45525bd0
JH
39#define WRITE_TREE_UNREADABLE_INDEX (-1)
40#define WRITE_TREE_UNMERGED_INDEX (-2)
41#define WRITE_TREE_PREFIX_ERROR (-3)
42
d11b8d34 43int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix);
b9d37a54
JH
44void prime_cache_tree(struct cache_tree **, struct tree *);
45
b65982b6
JH
46extern int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info);
47
74986462 48#endif