mark_parents_uninteresting(): avoid most allocation
commit8702b30fd7b6c804f1bb59877a4c2f773fbe00f8
authorJeff King <peff@peff.net>
Fri, 11 May 2018 18:03:15 +0000 (11 14:03 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 13 May 2018 02:33:09 +0000 (13 11:33 +0900)
tree36e34a8e8bfb9ea98cb67396586393e093846d55
parent43fc643b75af91363eb1246528c706c1654ddc2e
mark_parents_uninteresting(): avoid most allocation

Commit 941ba8db57 (Eliminate recursion in setting/clearing
marks in commit list, 2012-01-14) used a clever double-loop
to avoid allocations for single-parent chains of history.
However, it did so only when following parents of parents
(which was an uncommon case), and _always_ incurred at least
one allocation to populate the list of pending parents in
the first place.

We can turn this into zero-allocation in the common case by
iterating directly over the initial parent list, and then
following up on any pending items we might have discovered.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c