commit 98fdf1e045e1e5aca2bddf8ca07778ef7dd86a78 from: Stefan Sperling date: Sat Jun 16 21:50:18 2018 UTC iter_node insertion hack in commit graph shouldn't be needed commit - 4bb494d57939f42bed86833b18d100c54b234533 commit + 98fdf1e045e1e5aca2bddf8ca07778ef7dd86a78 blob - 958b66ec82b4dd7e18be4a27f9d081e78e7b6484 blob + 4ec98d9b24d734b3a32faf3dae874a0ca67ac6dc --- lib/commit_graph.c +++ lib/commit_graph.c @@ -155,23 +155,6 @@ add_node_to_iter_list(struct got_commit_graph *graph, return; } - /* Ensure that an iteration in progress will see this new commit. */ - if (graph->iter_node) { - n = graph->iter_node; - while (n) { - next = TAILQ_NEXT(n, entry); - if (next && - node->commit_timestamp >= next->commit_timestamp) { - TAILQ_INSERT_BEFORE(next, node, entry); - return; - } - n = next; - } - TAILQ_INSERT_AFTER(&graph->iter_list, graph->iter_node, - node, entry); - return; - } - /* * If a child node is known, begin looping over the list there * instead of beginning from the list head. @@ -181,6 +164,10 @@ add_node_to_iter_list(struct got_commit_graph *graph, /* Insert into list based on committer timestamp. */ do { if (node->commit_timestamp == n->commit_timestamp) { + /* + * Insert after, rather than before, so that an + * iteration in progress will see this new commit. + */ TAILQ_INSERT_AFTER(&graph->iter_list, n, node, entry); break; } else if (node->commit_timestamp < n->commit_timestamp) {