X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=commit.c;h=b8bf35e86081a638137c49e9eabb18c466dec1e5;hb=5ea06e2014a910240408f74b9dab2128a30fd06c;hp=e867b86e6a10d64354226b04f71df98d7448e072;hpb=27dedf0c3b78d1072fb5449149421284f9e5297b;p=git.git diff --git a/commit.c b/commit.c index e867b86e..b8bf35e8 100644 --- 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; @@ -352,6 +352,21 @@ struct commit *pop_most_recent_commit(struct commit_list **list, return ret; } +void clear_commit_marks(struct commit *commit, unsigned int mark) +{ + struct commit_list *parents; + + parents = commit->parents; + commit->object.flags &= ~mark; + while (parents) { + struct commit *parent = parents->item; + if (parent && parent->object.parsed && + (parent->object.flags & mark)) + clear_commit_marks(parent, mark); + parents = parents->next; + } +} + /* * Generic support for pretty-printing the header */ @@ -560,6 +575,9 @@ void sort_in_topological_order(struct commit_list ** list) next = next->next; count++; } + + if (!count) + return; /* allocate an array to help sort the list */ nodes = xcalloc(count, sizeof(*nodes)); /* link the list to the array */