diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2018-04-06 19:09:32 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-11 10:47:16 +0900 |
commit | 891435d55da80ca3654b19834481205be6bdfe33 (patch) | |
tree | fddc1768c14c6567f7be5205bf808d8bae86981a /notes-merge.c | |
parent | 2d5792f0716605ff0059fe4b5c865d6821c0161e (diff) | |
download | git-891435d55da80ca3654b19834481205be6bdfe33.tar.gz |
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>
Diffstat (limited to 'notes-merge.c')
-rw-r--r-- | notes-merge.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/notes-merge.c b/notes-merge.c index c09c5e0e47..1d3edc8942 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -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 */ |