]>
| Commit | Line | Data |
|---|---|---|
| 6eb8ae00 DB |
1 | #ifndef TREE_H |
| 2 | #define TREE_H | |
| 3 | ||
| 4 | #include "object.h" | |
| 5 | ||
| d1cbe1e6 | 6 | struct pathspec; |
| e092073d | 7 | struct repository; |
| 6a0b0b6d | 8 | struct strbuf; |
| 6eb8ae00 DB |
9 | |
| 10 | struct tree { | |
| 11 | struct object object; | |
| 136f2e54 LT |
12 | void *buffer; |
| 13 | unsigned long size; | |
| 6eb8ae00 DB |
14 | }; |
| 15 | ||
| e092073d NTND |
16 | extern const char *tree_type; |
| 17 | ||
| f58a6cb6 | 18 | struct tree *lookup_tree(struct repository *r, const struct object_id *oid); |
| 6eb8ae00 | 19 | |
| bd2c39f5 NP |
20 | int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size); |
| 21 | ||
| a8a50f29 | 22 | #define parse_tree_gently(t, q) repo_parse_tree_gently(the_repository, t, q) |
| 2b74f68c RS |
23 | int repo_parse_tree_gently(struct repository *r, struct tree *item, |
| 24 | int quiet_on_missing); | |
| a8a50f29 | 25 | #define parse_tree(t) repo_parse_tree(the_repository, t) |
| 2b74f68c RS |
26 | static inline int repo_parse_tree(struct repository *r, struct tree *item) |
| 27 | { | |
| 28 | return repo_parse_tree_gently(r, item, 0); | |
| 29 | } | |
| 6e454b9a | 30 | void free_tree_buffer(struct tree *tree); |
| 6eb8ae00 | 31 | |
| 77675e2a | 32 | /* Parses and returns the tree in the given ent, chasing tags and commits. */ |
| a8a50f29 | 33 | #define parse_tree_indirect(o) repo_parse_tree_indirect(the_repository, o) |
| 2b74f68c RS |
34 | struct tree *repo_parse_tree_indirect(struct repository *r, |
| 35 | const struct object_id *oid); | |
| 77675e2a | 36 | |
| 53dca334 EN |
37 | /* |
| 38 | * Functions for comparing pathnames | |
| 39 | */ | |
| 40 | int base_name_compare(const char *name1, size_t len1, int mode1, | |
| 41 | const char *name2, size_t len2, int mode2); | |
| 42 | int df_name_compare(const char *name1, size_t len1, int mode1, | |
| 43 | const char *name2, size_t len2, int mode2); | |
| 44 | int name_compare(const char *name1, size_t len1, | |
| 45 | const char *name2, size_t len2); | |
| 70912f66 | 46 | |
| 3c5e8468 | 47 | #define READ_TREE_RECURSIVE 1 |
| 47957485 | 48 | typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *); |
| 3c5e8468 | 49 | |
| 6c9fc42e ÆAB |
50 | int read_tree_at(struct repository *r, |
| 51 | struct tree *tree, struct strbuf *base, | |
| 1ee7a5c3 | 52 | int depth, |
| 6c9fc42e ÆAB |
53 | const struct pathspec *pathspec, |
| 54 | read_tree_fn_t fn, void *context); | |
| 55 | ||
| 47957485 ÆAB |
56 | int read_tree(struct repository *r, |
| 57 | struct tree *tree, | |
| 58 | const struct pathspec *pathspec, | |
| 59 | read_tree_fn_t fn, void *context); | |
| 60 | ||
| 6eb8ae00 | 61 | #endif /* TREE_H */ |