revision.h: drop extern from function declaration
[gitweb.git] / tree.c
diff --git a/tree.c b/tree.c
index 12b69606ab0dafc90ea139e9b0191581cb788b8e..215d3fdc7c4af2ef2faca1cf5d5d0b5de52b84a8 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -19,15 +19,13 @@ static int read_one_entry_opt(struct index_state *istate,
                              unsigned mode, int stage, int opt)
 {
        int len;
-       unsigned int size;
        struct cache_entry *ce;
 
        if (S_ISDIR(mode))
                return READ_TREE_RECURSIVE;
 
        len = strlen(pathname);
-       size = cache_entry_size(baselen + len);
-       ce = xcalloc(1, size);
+       ce = make_empty_cache_entry(istate, baselen + len);
 
        ce->ce_mode = create_ce_mode(mode);
        ce->ce_flags = create_ce_flags(stage);
@@ -101,7 +99,7 @@ static int read_tree_1(struct tree *tree, struct strbuf *base,
                else if (S_ISGITLINK(entry.mode)) {
                        struct commit *commit;
 
-                       commit = lookup_commit(entry.oid);
+                       commit = lookup_commit(the_repository, entry.oid);
                        if (!commit)
                                die("Commit %s in submodule path %s%s not found",
                                    oid_to_hex(entry.oid),
@@ -195,13 +193,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)