}
}
-struct tree *get_commit_tree(const struct commit *commit)
+static inline void set_commit_tree(struct commit *c, struct tree *t)
+{
+ c->maybe_tree = t;
+}
+
+struct tree *repo_get_commit_tree(struct repository *r,
+ const struct commit *commit)
{
if (commit->maybe_tree || !commit->object.parsed)
return commit->maybe_tree;
if (commit->graph_pos != COMMIT_NOT_FROM_GRAPH)
- return get_commit_tree_in_graph(the_repository, commit);
+ return get_commit_tree_in_graph(r, commit);
return NULL;
}
void release_commit_memory(struct parsed_object_pool *pool, struct commit *c)
{
- c->maybe_tree = NULL;
+ set_commit_tree(c, NULL);
c->index = 0;
free_commit_buffer(pool, c);
free_commit_list(c->parents);
if (get_oid_hex(bufptr + 5, &parent) < 0)
return error("bad tree pointer in commit %s",
oid_to_hex(&item->object.oid));
- item->maybe_tree = lookup_tree(r, &parent);
+ set_commit_tree(item, lookup_tree(r, &parent));
bufptr += tree_entry_len + 1; /* "tree " + "hex sha1" + "\n" */
pptr = &item->parents;