some commits were missing from the commit graph
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/lib/commit_graph.c b/lib/commit_graph.c
index 7c351cc..7dd5b8b 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -199,7 +199,7 @@ static const struct got_error *
add_iteration_candidate(struct got_commit_graph *graph,
struct got_commit_graph_node *node)
{
- struct got_commit_graph_node *n;
+ struct got_commit_graph_node *n, *next;
if (TAILQ_EMPTY(&graph->iter_candidates)) {
TAILQ_INSERT_TAIL(&graph->iter_candidates, node, entry);
@@ -212,10 +212,24 @@ add_iteration_candidate(struct got_commit_graph *graph,
err = compare_commits(&cmp, node->commit, n->commit);
if (err)
return err;
- if (cmp < 0)
- continue;
- TAILQ_INSERT_BEFORE(n, node, entry);
- break;
+ if (cmp < 0) {
+ next = TAILQ_NEXT(n, entry);
+ if (next == NULL) {
+ TAILQ_INSERT_AFTER(&graph->iter_candidates, n,
+ node, entry);
+ break;
+ }
+ err = compare_commits(&cmp, node->commit, next->commit);
+ if (err)
+ return err;
+ if (cmp >= 0) {
+ TAILQ_INSERT_BEFORE(next, node, entry);
+ break;
+ }
+ } else {
+ TAILQ_INSERT_BEFORE(n, node, entry);
+ break;
+ }
}
return NULL;