{"thread":{"id":"13289","subject":"[updated PATCH] Check for circular references causing 'lost' nodes","startedAt":"2008-04-27T17:32:46Z","lastAt":"2008-04-27T17:32:46Z","messageCount":1,"participants":["Stephen R. van den Berg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"75306","messageId":"20080427173246.10023.36908.stgit@aristoteles.cuci.nl","threadId":"13289","inReplyTo":null,"subject":"[updated PATCH] Check for circular references causing 'lost' nodes","fromName":"Stephen R. van den Berg","fromEmail":"srb@cuci.nl","sentAt":"2008-04-27T17:32:46Z","receivedAt":"2008-04-27T17:32:46Z","isPatch":true,"sender":{"key":"srb@cuci.nl","avatar":"https://gravatar.com/avatar/f75389059e827634d38e9df2a9b6ecbd50028b5a454442efa1c7205b7ff29c6a?d=mp&s=160"},"body":"The most likely cause for circular references are bad entries in the\ngrafts file; since basically noone tells you where you went wrong, it\ncan be a bit puzzling to find out that part of your tree goes dark\nsometimes, depending on which tool/options you pick to walk the\ncommit-tree (most notably, things go wrong when using --topo-order even\nthough things *seem* allright without that option).\n\nSigned-off-by: Stephen R. van den Berg <srb@cuci.nl>\n---\n\n commit.c |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\n\ndiff --git a/commit.c b/commit.c\nindex 94d5b3d..a3afad7 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -426,6 +426,7 @@ void sort_in_topological_order(struct commit_list ** list, int lifo)\n \tstruct commit_list *next, *orig = *list;\n \tstruct commit_list *work, **insert;\n \tstruct commit_list **pptr;\n+\tint nelements = 0;\n \n \tif (!orig)\n \t\treturn;\n@@ -436,6 +437,7 @@ void sort_in_topological_order(struct commit_list ** list, int lifo)\n \t\tstruct commit *commit = next->item;\n \t\tcommit->object.flags |= TOPOSORT;\n \t\tcommit->indegree = 0;\n+\t\tnelements++;\n \t}\n \n \t/* update the indegree */\n@@ -506,7 +508,12 @@ void sort_in_topological_order(struct commit_list ** list, int lifo)\n \t\tcommit->object.flags &= ~TOPOSORT;\n \t\t*pptr = work_item;\n \t\tpptr = &work_item->next;\n+\t\tnelements--;\n \t}\n+\tif (nelements)\n+\t\tfprintf(stderr,\n+\t\t \"Circular references resulting in %d suppressed nodes\\n\",\n+\t\t nelements);\n }\n \n /* merge-base stuff */\n"}]}