blob: 2ff01a4f839ecc2206fcc1c13fee9d5d202b1128 [file] [log] [blame]
Daniel Barkalow6eb8ae02005-04-18 11:39:48 -07001#ifndef TREE_H
2#define TREE_H
3
4#include "object.h"
5
6extern const char *tree_type;
7
8struct tree {
9 struct object object;
Linus Torvalds136f2e52006-05-29 12:16:12 -070010 void *buffer;
11 unsigned long size;
Daniel Barkalow6eb8ae02005-04-18 11:39:48 -070012};
13
Jason McMullan5d6ccf52005-06-03 11:05:39 -040014struct tree *lookup_tree(const unsigned char *sha1);
Daniel Barkalow6eb8ae02005-04-18 11:39:48 -070015
Nicolas Pitrebd2c39f2005-05-06 13:48:34 -040016int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
17
Daniel Barkalow6eb8ae02005-04-18 11:39:48 -070018int parse_tree(struct tree *tree);
19
Daniel Barkalow77675e22005-09-05 02:03:51 -040020/* Parses and returns the tree in the given ent, chasing tags and commits. */
21struct tree *parse_tree_indirect(const unsigned char *sha1);
22
Linus Torvalds3c5e8462005-11-26 09:38:20 -080023#define READ_TREE_RECURSIVE 1
René Scharfe671f0702008-07-14 21:22:12 +020024typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int, void *);
Linus Torvalds3c5e8462005-11-26 09:38:20 -080025
Daniel Barkalow521698b2006-01-26 01:13:36 -050026extern int read_tree_recursive(struct tree *tree,
27 const char *base, int baselen,
28 int stage, const char **match,
René Scharfe671f0702008-07-14 21:22:12 +020029 read_tree_fn_t fn, void *context);
Linus Torvalds3c5e8462005-11-26 09:38:20 -080030
Daniel Barkalow521698b2006-01-26 01:13:36 -050031extern int read_tree(struct tree *tree, int stage, const char **paths);
Linus Torvalds3c5e8462005-11-26 09:38:20 -080032
Daniel Barkalow6eb8ae02005-04-18 11:39:48 -070033#endif /* TREE_H */