| Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 1 | #ifndef TREE_H |
| 2 | #define TREE_H |
| 3 | |
| 4 | #include "object.h" |
| 5 | |
| 6 | extern const char *tree_type; |
| 7 | |
| 8 | struct tree { |
| 9 | struct object object; |
| Linus Torvalds | 136f2e5 | 2006-05-29 19:16:12 | [diff] [blame] | 10 | void *buffer; |
| 11 | unsigned long size; |
| Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 12 | }; |
| 13 | |
| Jason McMullan | 5d6ccf5 | 2005-06-03 15:05:39 | [diff] [blame] | 14 | struct tree *lookup_tree(const unsigned char *sha1); |
| Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 15 | |
| Nicolas Pitre | bd2c39f | 2005-05-06 17:48:34 | [diff] [blame] | 16 | int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size); |
| 17 | |
| Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 18 | int parse_tree(struct tree *tree); |
| Jeff King | 6e454b9 | 2013-06-05 22:37:39 | [diff] [blame] | 19 | void free_tree_buffer(struct tree *tree); |
| Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 20 | |
| Daniel Barkalow | 77675e2 | 2005-09-05 06:03:51 | [diff] [blame] | 21 | /* Parses and returns the tree in the given ent, chasing tags and commits. */ |
| 22 | struct tree *parse_tree_indirect(const unsigned char *sha1); |
| 23 | |
| Linus Torvalds | 3c5e846 | 2005-11-26 17:38:20 | [diff] [blame] | 24 | #define READ_TREE_RECURSIVE 1 |
| René Scharfe | 671f070 | 2008-07-14 19:22:12 | [diff] [blame] | 25 | typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int, void *); |
| Linus Torvalds | 3c5e846 | 2005-11-26 17:38:20 | [diff] [blame] | 26 | |
| Daniel Barkalow | 521698b | 2006-01-26 06:13:36 | [diff] [blame] | 27 | extern int read_tree_recursive(struct tree *tree, |
| 28 | const char *base, int baselen, |
| Nguyễn Thái Ngọc Duy | 18e4f40 | 2013-07-14 08:35:52 | [diff] [blame] | 29 | int stage, const struct pathspec *pathspec, |
| René Scharfe | 671f070 | 2008-07-14 19:22:12 | [diff] [blame] | 30 | read_tree_fn_t fn, void *context); |
| Linus Torvalds | 3c5e846 | 2005-11-26 17:38:20 | [diff] [blame] | 31 | |
| Nguyễn Thái Ngọc Duy | f0096c0 | 2011-03-25 09:34:19 | [diff] [blame] | 32 | extern int read_tree(struct tree *tree, int stage, struct pathspec *pathspec); |
| Linus Torvalds | 3c5e846 | 2005-11-26 17:38:20 | [diff] [blame] | 33 | |
| Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 34 | #endif /* TREE_H */ |