diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-01-29 13:18:56 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-29 13:18:56 -0800 |
commit | 5a304dd303cd47d8b05b17766399010a674e799a (patch) | |
tree | d86367b58b7367bb488205157b87e003fb0fc1cd /commit.c | |
parent | 86e15ff4fe9924b73af32d1bebe77eb5592b93cd (diff) | |
parent | 20e95d0a8475ce467903e1aaad5c2fd47777fcc8 (diff) | |
download | git-5a304dd303cd47d8b05b17766399010a674e799a.tar.gz git-5a304dd303cd47d8b05b17766399010a674e799a.tar.xz |
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.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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; |