path: root/list-objects.c
diff options
authorDerrick Stolee <>2018-04-06 19:09:32 (GMT)
committerJunio C Hamano <>2018-04-11 01:47:16 (GMT)
commit891435d55da80ca3654b19834481205be6bdfe33 (patch)
treefddc1768c14c6567f7be5205bf808d8bae86981a /list-objects.c
parent2d5792f0716605ff0059fe4b5c865d6821c0161e (diff)
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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'list-objects.c')
1 files changed, 5 insertions, 5 deletions
diff --git a/list-objects.c b/list-objects.c
index 168bef6..bfd09f5 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))
- mark_tree_uninteresting(parent->tree);
+ mark_tree_uninteresting(parent->maybe_tree);
if (revs->edge_hint && !(parent->object.flags & SHOWN)) {
parent->object.flags |= SHOWN;
@@ -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;
@@ -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))
- mark_tree_uninteresting(commit->tree);
+ mark_tree_uninteresting(commit->maybe_tree);
if (!(obj->flags & SHOWN)) {
obj->flags |= SHOWN;
@@ -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)