Merge branch 'ds/lazy-load-trees'

The code has been taught to use the duplicated information stored
in the commit-graph file to learn the tree object name for a commit
to avoid opening and parsing the commit object when it makes sense
to do so.

* ds/lazy-load-trees:
  coccinelle: avoid wrong transformation suggestions from commit.cocci
  commit-graph: lazy-load trees for commits
  treewide: replace maybe_tree with accessor methods
  commit: create get_commit_tree() method
  treewide: rename tree to maybe_tree
This commit is contained in:
Junio C Hamano
2018-05-23 14:38:13 +09:00
26 changed files with 152 additions and 66 deletions

View File

@ -101,7 +101,7 @@ static struct commit *make_virtual_commit(struct tree *tree, const char *comment
struct commit *commit = alloc_commit_node();
set_merge_remote_desc(commit, comment, (struct object *)commit);
commit->tree = tree;
commit->maybe_tree = tree;
commit->object.parsed = 1;
return commit;
}
@ -2154,7 +2154,8 @@ int merge_recursive(struct merge_options *o,
read_cache();
o->ancestor = "merged common ancestors";
clean = merge_trees(o, h1->tree, h2->tree, merged_common_ancestors->tree,
clean = merge_trees(o, get_commit_tree(h1), get_commit_tree(h2),
get_commit_tree(merged_common_ancestors),
&mrtree);
if (clean < 0) {
flush_output(o);