summaryrefslogtreecommitdiffstats
path: root/list-objects.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2018-04-06 19:09:32 +0000
committerJunio C Hamano <gitster@pobox.com>2018-04-11 10:47:16 +0900
commit891435d55da80ca3654b19834481205be6bdfe33 (patch)
treefddc1768c14c6567f7be5205bf808d8bae86981a /list-objects.c
parent2d5792f0716605ff0059fe4b5c865d6821c0161e (diff)
downloadgit-891435d55da80ca3654b19834481205be6bdfe33.tar.gz
git-891435d55da80ca3654b19834481205be6bdfe33.tar.xz
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 'list-objects.c')
-rw-r--r--list-objects.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/list-objects.c b/list-objects.c
index 168bef688..bfd09f545 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -195,7 +195,7 @@ static void mark_edge_parents_uninteresting(struct commit *commit,
struct commit *parent = parents->item;
if (!(parent->object.flags & UNINTERESTING))
continue;
- mark_tree_uninteresting(parent->tree);
+ mark_tree_uninteresting(parent->maybe_tree);
if (revs->edge_hint && !(parent->object.flags & SHOWN)) {
parent->object.flags |= SHOWN;
show_edge(parent);
@@ -212,7 +212,7 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
struct commit *commit = list->item;
if (commit->object.flags & UNINTERESTING) {
- mark_tree_uninteresting(commit->tree);
+ mark_tree_uninteresting(commit->maybe_tree);
if (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) {
commit->object.flags |= SHOWN;
show_edge(commit);
@@ -227,7 +227,7 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
struct commit *commit = (struct commit *)obj;
if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
continue;
- mark_tree_uninteresting(commit->tree);
+ mark_tree_uninteresting(commit->maybe_tree);
if (!(obj->flags & SHOWN)) {
obj->flags |= SHOWN;
show_edge(commit);
@@ -300,8 +300,8 @@ static void do_traverse(struct rev_info *revs,
* an uninteresting boundary commit may not have its tree
* parsed yet, but we are not going to show them anyway
*/
- if (commit->tree)
- add_pending_tree(revs, commit->tree);
+ if (commit->maybe_tree)
+ add_pending_tree(revs, commit->maybe_tree);
show_commit(commit, show_data);
if (revs->tree_blobs_in_commit_order)