test-lib: unset GIT_TRACE
[gitweb.git] / commit.c
index 12882fd496e5c18dacae76a6c68784700ce63721..c6bf10d045a45a38352af0a7dc0b3732b7493182 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -397,12 +397,14 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
 {
        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;
        }
 }