tree-walk: use size_t consistently
[gitweb.git] / commit.c
index 043ba64f1755492e4aaafaf8da38b7edd8c8556a..26ce0770f688eb94d5be5975d756752dbc0337a8 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -345,15 +345,16 @@ static inline void set_commit_tree(struct commit *c, struct tree *t)
        c->maybe_tree = t;
 }
 
-struct tree *get_commit_tree(const struct commit *commit)
+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)
-               BUG("commit has NULL tree, but was not loaded from commit-graph");
+       if (commit->graph_pos != COMMIT_NOT_FROM_GRAPH)
+               return get_commit_tree_in_graph(r, commit);
 
-       return get_commit_tree_in_graph(the_repository, commit);
+       return NULL;
 }
 
 struct object_id *get_commit_tree_oid(const struct commit *commit)
@@ -448,7 +449,7 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b
        item->date = parse_commit_date(bufptr, tail);
 
        if (check_graph)
-               load_commit_graph_info(the_repository, item);
+               load_commit_graph_info(r, item);
 
        return 0;
 }