Skip to content

Commit

Permalink
Don't recurse into parents marked uninteresting.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthias Urlichs authored and Junio C Hamano committed Mar 9, 2006
1 parent c13c6bf commit d2c4af7
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d2c4af7

Please sign in to comment.