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