summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorLibravatar Matthias Urlichs <smurf@smurf.noris.de>2006-03-09 05:04:36 +0100
committerLibravatar Junio C Hamano <junkio@cox.net>2006-03-09 01:49:07 -0800
commitd2c4af73738229e2b7c640f818f56f17d1d9edf8 (patch)
tree1a549acae07fa9741e75e7c6c86bf1092f2ab710 /revision.c
parentdiff-delta: bound hash list length to avoid O(m*n) behavior (diff)
downloadtgif-d2c4af73738229e2b7c640f818f56f17d1d9edf8.tar.xz
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>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/revision.c b/revision.c
index 2a33637f62..713f27e3ce 100644
--- a/revision.c
+++ b/revision.c
@@ -82,18 +82,20 @@ void mark_parents_uninteresting(struct commit *commit)
while (parents) {
struct commit *commit = parents->item;
- commit->object.flags |= UNINTERESTING;
-
- /*
- * Normally we haven't parsed the parent
- * yet, so we won't have a parent of a parent
- * here. However, it may turn out that we've
- * reached this commit some other way (where it
- * wasn't uninteresting), in which case we need
- * to mark its parents recursively too..
- */
- if (commit->parents)
- mark_parents_uninteresting(commit);
+ if (!(commit->object.flags & UNINTERESTING)) {
+ commit->object.flags |= UNINTERESTING;
+
+ /*
+ * Normally we haven't parsed the parent
+ * yet, so we won't have a parent of a parent
+ * here. However, it may turn out that we've
+ * reached this commit some other way (where it
+ * wasn't uninteresting), in which case we need
+ * to mark its parents recursively too..
+ */
+ if (commit->parents)
+ mark_parents_uninteresting(commit);
+ }
/*
* A missing commit is ok iff its parent is marked