summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-01-29 21:18:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-01-29 21:18:56 (GMT)
commit5a304dd303cd47d8b05b17766399010a674e799a (patch)
treed86367b58b7367bb488205157b87e003fb0fc1cd /revision.c
parent86e15ff4fe9924b73af32d1bebe77eb5592b93cd (diff)
parent20e95d0a8475ce467903e1aaad5c2fd47777fcc8 (diff)
downloadgit-5a304dd303cd47d8b05b17766399010a674e799a.zip
git-5a304dd303cd47d8b05b17766399010a674e799a.tar.gz
git-5a304dd303cd47d8b05b17766399010a674e799a.tar.bz2
Merge branch 'nd/index-pack-no-recurse'
* nd/index-pack-no-recurse: index-pack: eliminate unlimited recursion in get_base_data() index-pack: eliminate recursion in find_unresolved_deltas Eliminate recursion in setting/clearing marks in commit list
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/revision.c b/revision.c
index eb0be42..c97d834 100644
--- a/revision.c
+++ b/revision.c
@@ -139,11 +139,32 @@ void mark_tree_uninteresting(struct tree *tree)
void mark_parents_uninteresting(struct commit *commit)
{
- struct commit_list *parents = commit->parents;
+ struct commit_list *parents = NULL, *l;
+
+ for (l = commit->parents; l; l = l->next)
+ commit_list_insert(l->item, &parents);
while (parents) {
struct commit *commit = parents->item;
- if (!(commit->object.flags & UNINTERESTING)) {
+ l = parents;
+ parents = parents->next;
+ free(l);
+
+ while (commit) {
+ /*
+ * A missing commit is ok iff its parent is marked
+ * uninteresting.
+ *
+ * We just mark such a thing parsed, so that when
+ * it is popped next time around, we won't be trying
+ * to parse it and get an error.
+ */
+ if (!has_sha1_file(commit->object.sha1))
+ commit->object.parsed = 1;
+
+ if (commit->object.flags & UNINTERESTING)
+ break;
+
commit->object.flags |= UNINTERESTING;
/*
@@ -154,21 +175,13 @@ void mark_parents_uninteresting(struct commit *commit)
* wasn't uninteresting), in which case we need
* to mark its parents recursively too..
*/
- if (commit->parents)
- mark_parents_uninteresting(commit);
- }
+ if (!commit->parents)
+ break;
- /*
- * A missing commit is ok iff its parent is marked
- * uninteresting.
- *
- * We just mark such a thing parsed, so that when
- * it is popped next time around, we won't be trying
- * to parse it and get an error.
- */
- if (!has_sha1_file(commit->object.sha1))
- commit->object.parsed = 1;
- parents = parents->next;
+ for (l = commit->parents->next; l; l = l->next)
+ commit_list_insert(l->item, &parents);
+ commit = commit->parents->item;
+ }
}
}