[updated PATCH] Check for circular references causing 'lost' nodes
From: Stephen R. van den Berg <hidden>
Date: 2016-06-15 22:44:32
Subsystem:
the rest · Maintainer:
Linus Torvalds
The most likely cause for circular references are bad entries in the grafts file; since basically noone tells you where you went wrong, it can be a bit puzzling to find out that part of your tree goes dark sometimes, depending on which tool/options you pick to walk the commit-tree (most notably, things go wrong when using --topo-order even though things *seem* allright without that option). Signed-off-by: Stephen R. van den Berg <redacted> --- commit.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/commit.c b/commit.c
index 94d5b3d..a3afad7 100644
--- a/commit.c
+++ b/commit.c@@ -426,6 +426,7 @@ void sort_in_topological_order(struct commit_list ** list, int lifo) struct commit_list *next, *orig = *list; struct commit_list *work, **insert; struct commit_list **pptr; + int nelements = 0; if (!orig) return;
@@ -436,6 +437,7 @@ void sort_in_topological_order(struct commit_list ** list, int lifo) struct commit *commit = next->item; commit->object.flags |= TOPOSORT; commit->indegree = 0; + nelements++; } /* update the indegree */
@@ -506,7 +508,12 @@ void sort_in_topological_order(struct commit_list ** list, int lifo) commit->object.flags &= ~TOPOSORT; *pptr = work_item; pptr = &work_item->next; + nelements--; } + if (nelements) + fprintf(stderr, + "Circular references resulting in %d suppressed nodes\n", + nelements); } /* merge-base stuff */