1#ifndef TREE_H
2#define TREE_H
34
#include "object.h"
56
extern const char *tree_type;
7struct strbuf;
89
struct tree {
10struct object object;
11void *buffer;
12unsigned long size;
13};
1415
struct tree *lookup_tree(const struct object_id *oid);
1617
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
1819
int parse_tree_gently(struct tree *tree, int quiet_on_missing);
20static inline int parse_tree(struct tree *tree)
21{
22return parse_tree_gently(tree, 0);
23}
24void free_tree_buffer(struct tree *tree);
2526
/* Parses and returns the tree in the given ent, chasing tags and commits. */
27struct tree *parse_tree_indirect(const struct object_id *oid);
2829
#define READ_TREE_RECURSIVE 1
30typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, int, void *);
3132
extern int read_tree_recursive(struct tree *tree,
33const char *base, int baselen,
34int stage, const struct pathspec *pathspec,
35read_tree_fn_t fn, void *context);
3637
extern int read_tree(struct tree *tree, int stage, struct pathspec *pathspec,
38struct index_state *istate);
3940
#endif /* TREE_H */