summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-01-29 13:18:56 -0800
committerJunio C Hamano <gitster@pobox.com>2012-01-29 13:18:56 -0800
commit5a304dd303cd47d8b05b17766399010a674e799a (patch)
treed86367b58b7367bb488205157b87e003fb0fc1cd /commit.c
parent86e15ff4fe9924b73af32d1bebe77eb5592b93cd (diff)
parent20e95d0a8475ce467903e1aaad5c2fd47777fcc8 (diff)
downloadgit-5a304dd303cd47d8b05b17766399010a674e799a.tar.gz
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 'commit.c')
-rw-r--r--commit.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/commit.c b/commit.c
index 35af4988f0..4b39c19123 100644
--- a/commit.c
+++ b/commit.c
@@ -422,7 +422,8 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
return ret;
}
-void clear_commit_marks(struct commit *commit, unsigned int mark)
+static void clear_commit_marks_1(struct commit_list **plist,
+ struct commit *commit, unsigned int mark)
{
while (commit) {
struct commit_list *parents;
@@ -437,12 +438,20 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
return;
while ((parents = parents->next))
- clear_commit_marks(parents->item, mark);
+ commit_list_insert(parents->item, plist);
commit = commit->parents->item;
}
}
+void clear_commit_marks(struct commit *commit, unsigned int mark)
+{
+ struct commit_list *list = NULL;
+ commit_list_insert(commit, &list);
+ while (list)
+ clear_commit_marks_1(&list, pop_commit(&list), mark);
+}
+
void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark)
{
struct object *object;