t4007: modernize the style
[git/git.git] / cache-tree.h
CommitLineData
74986462
JH
1#ifndef CACHE_TREE_H
2#define CACHE_TREE_H
3
b9d37a54
JH
4#include "tree.h"
5
74986462
JH
6struct cache_tree;
7struct cache_tree_sub {
8 struct cache_tree *cache_tree;
9 int namelen;
10 int used;
11 char name[FLEX_ARRAY];
12};
13
14struct cache_tree {
15 int entry_count; /* negative means "invalid" */
16 unsigned char sha1[20];
17 int subtree_nr;
18 int subtree_alloc;
19 struct cache_tree_sub **down;
20};
21
22struct cache_tree *cache_tree(void);
bad68ec9 23void cache_tree_free(struct cache_tree **);
74986462 24void cache_tree_invalidate_path(struct cache_tree *, const char *);
7927a55d 25struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
74986462 26
1dffb8fa 27void cache_tree_write(struct strbuf *, struct cache_tree *root);
bad68ec9 28struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
74986462 29
bad68ec9 30int cache_tree_fully_valid(struct cache_tree *);
2956dd3b 31int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int);
74986462 32
d11b8d34
JH
33/* bitmasks to write_cache_as_tree flags */
34#define WRITE_TREE_MISSING_OK 1
35#define WRITE_TREE_IGNORE_CACHE_TREE 2
36
37/* error return codes */
45525bd0
JH
38#define WRITE_TREE_UNREADABLE_INDEX (-1)
39#define WRITE_TREE_UNMERGED_INDEX (-2)
40#define WRITE_TREE_PREFIX_ERROR (-3)
41
d11b8d34 42int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix);
b9d37a54
JH
43void prime_cache_tree(struct cache_tree **, struct tree *);
44
74986462 45#endif