treewide: rename tree to maybe_tree
Using the commit-graph file to walk commit history removes the large cost of parsing commits during the walk. This exposes a performance issue: lookup_tree() takes a large portion of the computation time, even when Git never uses those trees. In anticipation of lazy-loading these trees, rename the 'tree' member of struct commit to 'maybe_tree'. This serves two purposes: it hints at the future role of possibly being NULL even if the commit has a valid tree, and it allows for unambiguous transformation from simple member access (i.e. commit->maybe_tree) to method access. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
2d5792f071
commit
891435d55d
@ -600,14 +600,14 @@ int notes_merge(struct notes_merge_options *o,
|
||||
printf("No merge base found; doing history-less merge\n");
|
||||
} else if (!bases->next) {
|
||||
base_oid = &bases->item->object.oid;
|
||||
base_tree_oid = &bases->item->tree->object.oid;
|
||||
base_tree_oid = &bases->item->maybe_tree->object.oid;
|
||||
if (o->verbosity >= 4)
|
||||
printf("One merge base found (%.7s)\n",
|
||||
oid_to_hex(base_oid));
|
||||
} else {
|
||||
/* TODO: How to handle multiple merge-bases? */
|
||||
base_oid = &bases->item->object.oid;
|
||||
base_tree_oid = &bases->item->tree->object.oid;
|
||||
base_tree_oid = &bases->item->maybe_tree->object.oid;
|
||||
if (o->verbosity >= 3)
|
||||
printf("Multiple merge bases found. Using the first "
|
||||
"(%.7s)\n", oid_to_hex(base_oid));
|
||||
@ -634,8 +634,8 @@ int notes_merge(struct notes_merge_options *o,
|
||||
goto found_result;
|
||||
}
|
||||
|
||||
result = merge_from_diffs(o, base_tree_oid, &local->tree->object.oid,
|
||||
&remote->tree->object.oid, local_tree);
|
||||
result = merge_from_diffs(o, base_tree_oid, &local->maybe_tree->object.oid,
|
||||
&remote->maybe_tree->object.oid, local_tree);
|
||||
|
||||
if (result != 0) { /* non-trivial merge (with or without conflicts) */
|
||||
/* Commit (partial) result */
|
||||
|
Reference in New Issue
Block a user