mirror of
https://github.com/git/git.git
synced 2024-05-26 15:16:09 +02:00
d1cbe1e6d8
hash.h depends upon and includes repository.h, due to the definition and use of the_hash_algo (defined as the_repository->hash_algo). However, most headers trying to include hash.h are only interested in the layout of the structs like object_id. Move the parts of hash.h that do not depend upon repository.h into a new file hash-ll.h (the "low level" parts of hash.h), and adjust other files to use this new header where the convenience inline functions aren't needed. This allows hash.h and object.h to be fairly small, minimal headers. It also exposes a lot of hidden dependencies on both path.h (which was brought in by repository.h) and repository.h (which was previously implicitly brought in by object.h), so also adjust other files to be more explicit about what they depend upon. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
48 lines
1.2 KiB
C
48 lines
1.2 KiB
C
#ifndef TREE_H
|
|
#define TREE_H
|
|
|
|
#include "object.h"
|
|
|
|
struct pathspec;
|
|
struct repository;
|
|
struct strbuf;
|
|
|
|
struct tree {
|
|
struct object object;
|
|
void *buffer;
|
|
unsigned long size;
|
|
};
|
|
|
|
extern const char *tree_type;
|
|
|
|
struct tree *lookup_tree(struct repository *r, 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);
|
|
|
|
int cmp_cache_name_compare(const void *a_, const void *b_);
|
|
|
|
#define READ_TREE_RECURSIVE 1
|
|
typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *);
|
|
|
|
int read_tree_at(struct repository *r,
|
|
struct tree *tree, struct strbuf *base,
|
|
const struct pathspec *pathspec,
|
|
read_tree_fn_t fn, void *context);
|
|
|
|
int read_tree(struct repository *r,
|
|
struct tree *tree,
|
|
const struct pathspec *pathspec,
|
|
read_tree_fn_t fn, void *context);
|
|
|
|
#endif /* TREE_H */
|