1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-09 20:46:09 +02:00

tree: allow lookup_tree to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller 2018-06-28 18:22:09 -07:00 committed by Junio C Hamano
parent 17126cdf78
commit f58a6cb602
2 changed files with 6 additions and 7 deletions

10
tree.c
View File

@ -195,13 +195,13 @@ int read_tree(struct tree *tree, int stage, struct pathspec *match,
return 0;
}
struct tree *lookup_tree_the_repository(const struct object_id *oid)
struct tree *lookup_tree(struct repository *r, const struct object_id *oid)
{
struct object *obj = lookup_object(the_repository, oid->hash);
struct object *obj = lookup_object(r, oid->hash);
if (!obj)
return create_object(the_repository, oid->hash,
alloc_tree_node(the_repository));
return object_as_type(the_repository, obj, OBJ_TREE, 0);
return create_object(r, oid->hash,
alloc_tree_node(r));
return object_as_type(r, obj, OBJ_TREE, 0);
}
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)

3
tree.h
View File

@ -12,8 +12,7 @@ struct tree {
unsigned long size;
};
#define lookup_tree(r, oid) lookup_tree_##r(oid)
struct tree *lookup_tree_the_repository(const struct object_id *oid);
struct tree *lookup_tree(struct repository *r, const struct object_id *oid);
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);