Merge branch 'master' of https://github.com/Softcatala/git-po
[gitweb.git] / commit.c
index 043ba64f1755492e4aaafaf8da38b7edd8c8556a..8fa1883c61c580578a755cdf2da009203d8d386e 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)