@matheusbsbs / matheus-bagliano / commits / d2c4af7373
Fork 0

Don't recurse into parents marked uninteresting.

revision.c:make_parents_uninteresting() is exponential with the number of merges in the tree. That's fine -- unless some other part of git already has pulled the whole commit tree into memory ... Signed-off-by: Junio C Hamano <junkio@cox.net>

Matthias Urlichs committed Mar 9, 2006 at 05:04 UTC d2c4af73738229e2b7c640f818f56f17d1d9edf8
1 file changed +14 -12
revision.c
+14 -12
@@ -82,18 +82,20 @@ void mark_parents_uninteresting(struct commit *commit)
82
83 while (parents) {
84 struct commit *commit = parents->item;
85 - commit->object.flags |= UNINTERESTING;
86 -
87 - /*
88 - * Normally we haven't parsed the parent
89 - * yet, so we won't have a parent of a parent
90 - * here. However, it may turn out that we've
91 - * reached this commit some other way (where it
92 - * wasn't uninteresting), in which case we need
93 - * to mark its parents recursively too..
94 - */
95 - if (commit->parents)
96 - mark_parents_uninteresting(commit);
85 + if (!(commit->object.flags & UNINTERESTING)) {
86 + commit->object.flags |= UNINTERESTING;
87 +
88 + /*
89 + * Normally we haven't parsed the parent
90 + * yet, so we won't have a parent of a parent
91 + * here. However, it may turn out that we've
92 + * reached this commit some other way (where it
93 + * wasn't uninteresting), in which case we need
94 + * to mark its parents recursively too..
95 + */
96 + if (commit->parents)
97 + mark_parents_uninteresting(commit);
98 + }
99
100 /*
101 * A missing commit is ok iff its parent is marked