{
struct commit_list *parents;
- if (!commit)
- return;
- parents = commit->parents;
commit->object.flags &= ~mark;
+ parents = commit->parents;
while (parents) {
- clear_commit_marks(parents->item, mark);
+ struct commit *parent = parents->item;
+
+ /* Have we already cleared this? */
+ if (mark & parent->object.flags)
+ clear_commit_marks(parent, mark);
parents = parents->next;
}
}