summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-06-29 01:22:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-29 17:43:39 (GMT)
commitf58a6cb60222d32063437ae85859e6e7ac7ffc8e (patch)
treea39aa36a86ea1c8377edf88608052bb92ad67382
parent17126cdf78dc7b8cbe6b35bc44cb74d8d0fb11ee (diff)
downloadgit-f58a6cb60222d32063437ae85859e6e7ac7ffc8e.zip
git-f58a6cb60222d32063437ae85859e6e7ac7ffc8e.tar.gz
git-f58a6cb60222d32063437ae85859e6e7ac7ffc8e.tar.bz2
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>
-rw-r--r--tree.c10
-rw-r--r--tree.h3
2 files changed, 6 insertions, 7 deletions
diff --git a/tree.c b/tree.c
index 45e89ff..78d440a 100644
--- 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 2ea21ed..d4807dc 100644
--- 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);