X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=commit.c;h=e9a29caa27fbdd94810abbc4fd9c44e06c81265c;hb=b21c31c9a5edfd90d6f85481517f979352da4eed;hp=e867b86e6a10d64354226b04f71df98d7448e072;hpb=36d277c72d90d32f99616072b64a2652248f5264;p=git.git diff --git a/commit.c b/commit.c index e867b86e..e9a29caa 100644 --- a/commit.c +++ b/commit.c @@ -352,6 +352,19 @@ 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) { + if (parents->item && parents->item->object.parsed) + clear_commit_marks(parents->item, mark); + parents = parents->next; + } +} + /* * Generic support for pretty-printing the header */ @@ -560,6 +573,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 */