Skip to content

Commit f58a6cb

Browse files
stefanbellergitster
authored andcommitted
tree: allow lookup_tree to handle arbitrary repositories
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 17126cd commit f58a6cb

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

tree.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ int read_tree(struct tree *tree, int stage, struct pathspec *match,
195195
return 0;
196196
}
197197

198-
struct tree *lookup_tree_the_repository(const struct object_id *oid)
198+
struct tree *lookup_tree(struct repository *r, const struct object_id *oid)
199199
{
200-
struct object *obj = lookup_object(the_repository, oid->hash);
200+
struct object *obj = lookup_object(r, oid->hash);
201201
if (!obj)
202-
return create_object(the_repository, oid->hash,
203-
alloc_tree_node(the_repository));
204-
return object_as_type(the_repository, obj, OBJ_TREE, 0);
202+
return create_object(r, oid->hash,
203+
alloc_tree_node(r));
204+
return object_as_type(r, obj, OBJ_TREE, 0);
205205
}
206206

207207
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)

tree.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ struct tree {
1212
unsigned long size;
1313
};
1414

15-
#define lookup_tree(r, oid) lookup_tree_##r(oid)
16-
struct tree *lookup_tree_the_repository(const struct object_id *oid);
15+
struct tree *lookup_tree(struct repository *r, const struct object_id *oid);
1716

1817
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
1918

0 commit comments

Comments
 (0)