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