hash-ll.h: split out of hash.h to remove dependency on repository.h
[alt-git.git] / tree.h
blob0499ad01aa7ee62ff02afa7bd8bcb6acd44ca144
1 #ifndef TREE_H
2 #define TREE_H
4 #include "object.h"
6 struct pathspec;
7 struct repository;
8 struct strbuf;
10 struct tree {
11 struct object object;
12 void *buffer;
13 unsigned long size;
16 extern const char *tree_type;
18 struct tree *lookup_tree(struct repository *r, const struct object_id *oid);
20 int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
22 int parse_tree_gently(struct tree *tree, int quiet_on_missing);
23 static inline int parse_tree(struct tree *tree)
25 return parse_tree_gently(tree, 0);
27 void free_tree_buffer(struct tree *tree);
29 /* Parses and returns the tree in the given ent, chasing tags and commits. */
30 struct tree *parse_tree_indirect(const struct object_id *oid);
32 int cmp_cache_name_compare(const void *a_, const void *b_);
34 #define READ_TREE_RECURSIVE 1
35 typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *);
37 int read_tree_at(struct repository *r,
38 struct tree *tree, struct strbuf *base,
39 const struct pathspec *pathspec,
40 read_tree_fn_t fn, void *context);
42 int read_tree(struct repository *r,
43 struct tree *tree,
44 const struct pathspec *pathspec,
45 read_tree_fn_t fn, void *context);
47 #endif /* TREE_H */