Daniel Barkalow | 6eb8ae0 | 2005-04-18 11:39:48 -0700 | [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 12:16:12 -0700 | [diff] [blame] | 10 | void *buffer; |
| 11 | unsigned long size; |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 11:39:48 -0700 | [diff] [blame] | 12 | }; |
| 13 | |
Jason McMullan | 5d6ccf5 | 2005-06-03 11:05:39 -0400 | [diff] [blame] | 14 | struct tree *lookup_tree(const unsigned char *sha1); |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 11:39:48 -0700 | [diff] [blame] | 15 | |
Nicolas Pitre | bd2c39f | 2005-05-06 13:48:34 -0400 | [diff] [blame] | 16 | int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size); |
| 17 | |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 11:39:48 -0700 | [diff] [blame] | 18 | int parse_tree(struct tree *tree); |
| 19 | |
Daniel Barkalow | 77675e2 | 2005-09-05 02:03:51 -0400 | [diff] [blame] | 20 | /* Parses and returns the tree in the given ent, chasing tags and commits. */ |
| 21 | struct tree *parse_tree_indirect(const unsigned char *sha1); |
| 22 | |
Linus Torvalds | 3c5e846 | 2005-11-26 09:38:20 -0800 | [diff] [blame] | 23 | #define READ_TREE_RECURSIVE 1 |
René Scharfe | 671f070 | 2008-07-14 21:22:12 +0200 | [diff] [blame] | 24 | typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int, void *); |
Linus Torvalds | 3c5e846 | 2005-11-26 09:38:20 -0800 | [diff] [blame] | 25 | |
Daniel Barkalow | 521698b | 2006-01-26 01:13:36 -0500 | [diff] [blame] | 26 | extern int read_tree_recursive(struct tree *tree, |
| 27 | const char *base, int baselen, |
| 28 | int stage, const char **match, |
René Scharfe | 671f070 | 2008-07-14 21:22:12 +0200 | [diff] [blame] | 29 | read_tree_fn_t fn, void *context); |
Linus Torvalds | 3c5e846 | 2005-11-26 09:38:20 -0800 | [diff] [blame] | 30 | |
Daniel Barkalow | 521698b | 2006-01-26 01:13:36 -0500 | [diff] [blame] | 31 | extern int read_tree(struct tree *tree, int stage, const char **paths); |
Linus Torvalds | 3c5e846 | 2005-11-26 09:38:20 -0800 | [diff] [blame] | 32 | |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 11:39:48 -0700 | [diff] [blame] | 33 | #endif /* TREE_H */ |