提交 f58a6cb6 编写于 作者: S Stefan Beller 提交者: Junio C Hamano

tree: allow lookup_tree to handle arbitrary repositories

Signed-off-by: NStefan Beller <sbeller@google.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 17126cdf
......@@ -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)
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册