commit-graph: load a root tree from specific graph
When lazy-loading a tree for a commit, it will be important to select the tree from a specific struct commit_graph. Create a new method that specifies the commit-graph file and use that in get_commit_tree_in_graph(). Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Jun 27, 2018 at 09:24 UTC
0cbef8f8ce6ff434011ecbf3d8d2d41ba6f10c70
1 file changed
+9
-3
commit-graph.c
+9
-3
@@ -362,14 +362,20 @@ static struct tree *load_tree_for_commit(struct commit_graph *g, struct commit *
362
return c->maybe_tree;
363
}
364
365
-struct tree *get_commit_tree_in_graph(const struct commit *c)
365
+static struct tree *get_commit_tree_in_graph_one(struct commit_graph *g,
366
+ const struct commit *c)
367
{
368
if (c->maybe_tree)
369
return c->maybe_tree;
370
if (c->graph_pos == COMMIT_NOT_FROM_GRAPH)
370
- BUG("get_commit_tree_in_graph called from non-commit-graph commit");
371
+ BUG("get_commit_tree_in_graph_one called from non-commit-graph commit");
372
+
373
+ return load_tree_for_commit(g, (struct commit *)c);
374
+}
375
372
- return load_tree_for_commit(commit_graph, (struct commit *)c);
376
+struct tree *get_commit_tree_in_graph(const struct commit *c)
377
+{
378
+ return get_commit_tree_in_graph_one(commit_graph, c);
379
}
380
381
static void write_graph_chunk_fanout(struct hashfile *f,