2006-04-23 23:52:20 +00:00
|
|
|
#ifndef CACHE_TREE_H
|
|
|
|
#define CACHE_TREE_H
|
|
|
|
|
2009-04-20 10:58:18 +00:00
|
|
|
#include "tree.h"
|
|
|
|
|
2006-04-23 23:52:20 +00:00
|
|
|
struct cache_tree;
|
|
|
|
struct cache_tree_sub {
|
|
|
|
struct cache_tree *cache_tree;
|
|
|
|
int namelen;
|
|
|
|
int used;
|
|
|
|
char name[FLEX_ARRAY];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cache_tree {
|
|
|
|
int entry_count; /* negative means "invalid" */
|
|
|
|
unsigned char sha1[20];
|
|
|
|
int subtree_nr;
|
|
|
|
int subtree_alloc;
|
|
|
|
struct cache_tree_sub **down;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cache_tree *cache_tree(void);
|
2006-04-25 04:18:58 +00:00
|
|
|
void cache_tree_free(struct cache_tree **);
|
2006-04-23 23:52:20 +00:00
|
|
|
void cache_tree_invalidate_path(struct cache_tree *, const char *);
|
2006-04-27 08:33:07 +00:00
|
|
|
struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
|
2006-04-23 23:52:20 +00:00
|
|
|
|
2007-09-25 08:22:44 +00:00
|
|
|
void cache_tree_write(struct strbuf *, struct cache_tree *root);
|
2006-04-25 04:18:58 +00:00
|
|
|
struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
|
2006-04-23 23:52:20 +00:00
|
|
|
|
2006-04-25 04:18:58 +00:00
|
|
|
int cache_tree_fully_valid(struct cache_tree *);
|
2006-04-27 23:21:54 +00:00
|
|
|
int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int);
|
2006-04-23 23:52:20 +00:00
|
|
|
|
2009-05-20 18:04:35 +00:00
|
|
|
/* bitmasks to write_cache_as_tree flags */
|
|
|
|
#define WRITE_TREE_MISSING_OK 1
|
|
|
|
#define WRITE_TREE_IGNORE_CACHE_TREE 2
|
|
|
|
|
|
|
|
/* error return codes */
|
2008-01-11 06:49:35 +00:00
|
|
|
#define WRITE_TREE_UNREADABLE_INDEX (-1)
|
|
|
|
#define WRITE_TREE_UNMERGED_INDEX (-2)
|
|
|
|
#define WRITE_TREE_PREFIX_ERROR (-3)
|
|
|
|
|
2009-05-20 18:04:35 +00:00
|
|
|
int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix);
|
2009-04-20 10:58:18 +00:00
|
|
|
void prime_cache_tree(struct cache_tree **, struct tree *);
|
|
|
|
|
2006-04-23 23:52:20 +00:00
|
|
|
#endif
|