]> git.ipfire.org Git - thirdparty/git.git/blame - cache-tree.h
read-tree A B: do not corrupt cache-tree
[thirdparty/git.git] / cache-tree.h
CommitLineData
74986462
JH
1#ifndef CACHE_TREE_H
2#define CACHE_TREE_H
3
4struct cache_tree;
5struct cache_tree_sub {
6 struct cache_tree *cache_tree;
7 int namelen;
8 int used;
9 char name[FLEX_ARRAY];
10};
11
12struct cache_tree {
13 int entry_count; /* negative means "invalid" */
14 unsigned char sha1[20];
15 int subtree_nr;
16 int subtree_alloc;
17 struct cache_tree_sub **down;
18};
19
20struct cache_tree *cache_tree(void);
bad68ec9 21void cache_tree_free(struct cache_tree **);
74986462 22void cache_tree_invalidate_path(struct cache_tree *, const char *);
7927a55d 23struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
74986462 24
1dffb8fa 25void cache_tree_write(struct strbuf *, struct cache_tree *root);
bad68ec9 26struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
74986462 27
bad68ec9 28int cache_tree_fully_valid(struct cache_tree *);
2956dd3b 29int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int);
74986462 30
45525bd0
JH
31#define WRITE_TREE_UNREADABLE_INDEX (-1)
32#define WRITE_TREE_UNMERGED_INDEX (-2)
33#define WRITE_TREE_PREFIX_ERROR (-3)
34
35int write_cache_as_tree(unsigned char *sha1, int missing_ok, const char *prefix);
74986462 36#endif