]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tree: allow lookup_tree to handle arbitrary repositories
authorStefan Beller <sbeller@google.com>
Fri, 29 Jun 2018 01:22:09 +0000 (18:22 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Jun 2018 17:43:39 +0000 (10:43 -0700)
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tree.c
tree.h

diff --git a/tree.c b/tree.c
index 45e89ff08ebdb57b0f3c501993741c7b01ccf32b..78d440a9c8f9367d65f074cfca98055bb9b30e95 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -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)
diff --git a/tree.h b/tree.h
index 2ea21ed174b63c042c1044f7806d0a4582aba620..d4807dc805827e6fe07fd01721a8a4680af3403f 100644 (file)
--- a/tree.h
+++ b/tree.h
@@ -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);