1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-20 02:56:12 +02:00
git/tree.h
Stefan Beller f86bcc7b2c tree: add repository argument to lookup_tree
Add a repository argument to allow the callers of lookup_tree
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-06-29 10:43:38 -07:00

42 lines
1.2 KiB
C

#ifndef TREE_H
#define TREE_H
#include "object.h"
extern const char *tree_type;
struct strbuf;
struct tree {
struct object object;
void *buffer;
unsigned long size;
};
#define lookup_tree(r, oid) lookup_tree_##r(oid)
struct tree *lookup_tree_the_repository(const struct object_id *oid);
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
int parse_tree_gently(struct tree *tree, int quiet_on_missing);
static inline int parse_tree(struct tree *tree)
{
return parse_tree_gently(tree, 0);
}
void free_tree_buffer(struct tree *tree);
/* Parses and returns the tree in the given ent, chasing tags and commits. */
struct tree *parse_tree_indirect(const struct object_id *oid);
#define READ_TREE_RECURSIVE 1
typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, int, void *);
extern int read_tree_recursive(struct tree *tree,
const char *base, int baselen,
int stage, const struct pathspec *pathspec,
read_tree_fn_t fn, void *context);
extern int read_tree(struct tree *tree, int stage, struct pathspec *pathspec,
struct index_state *istate);
#endif /* TREE_H */