git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[updated PATCH] Check for circular references causing 'lost' nodes

From
Stephen R. van den Berg <srb@cuci.nl>
Date
Apr 27, 2008, 17:32 UTC
Message-ID
<20080427173246.10023.36908.stgit@aristoteles.cuci.nl>

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 <srb@cuci.nl>
---
 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 */
Message 1 of 1 in “Check for circular references causing 'lost' nodes”
  1. Check for circular references causing 'lost' nodesStephen R. van den Berg, Apr 27, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.