Recommend to remove unused `origin` in a shared repository.
[gitweb.git] / commit.c
index e9a29caa27fbdd94810abbc4fd9c44e06c81265c..b8bf35e86081a638137c49e9eabb18c466dec1e5 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1,6 +1,6 @@
+#include "cache.h"
 #include "tag.h"
 #include "commit.h"
-#include "cache.h"
 
 int save_commit_buffer = 1;
 
@@ -359,8 +359,10 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
        parents = commit->parents;
        commit->object.flags &= ~mark;
        while (parents) {
-               if (parents->item && parents->item->object.parsed)
-                       clear_commit_marks(parents->item, mark);
+               struct commit *parent = parents->item;
+               if (parent && parent->object.parsed &&
+                   (parent->object.flags & mark))
+                       clear_commit_marks(parent, mark);
                parents = parents->next;
        }
 }