]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit: skip already cleared parents in clear_commit_marks_1()
authorRené Scharfe <l.s.r@web.de>
Tue, 13 Dec 2022 06:27:10 +0000 (07:27 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Dec 2022 13:07:08 +0000 (22:07 +0900)
Don't put clean parents on the pending list, as they and their ancestors
don't need any treatment and would be skipped later anyway.  This saves
the allocation and release of a commit list item in ca. 20% of the cases
during a run of the test suite.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c

index 89b8efc6116883d032912cdc38429b5a8ba5f2f6..115347977ae45f455488017f9d3718ccf07ee746 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -693,8 +693,10 @@ static void clear_commit_marks_1(struct commit_list **plist,
                if (!parents)
                        return;
 
-               while ((parents = parents->next))
-                       commit_list_insert(parents->item, plist);
+               while ((parents = parents->next)) {
+                       if (parents->item->object.flags & mark)
+                               commit_list_insert(parents->item, plist);
+               }
 
                commit = commit->parents->item;
        }