Commit d415e120d8f07423e264782724cce6af29c6432f

Stefan Sperling 2018-09-19T14:19:23

fix previous: last entry returned by graph iteration was duplicated

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/lib/commit_graph.c b/lib/commit_graph.c
index ce50bb5..f71dade 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -720,10 +720,9 @@ got_commit_graph_iter_next(struct got_object_id **id,
 	if (graph->iter_node ==
 	    TAILQ_LAST(&graph->iter_list, got_commit_graph_iter_list) &&
 	    got_object_idset_num_elements(graph->open_branches) == 0) {
-		*id = &graph->iter_node->id;
 		/* We are done iterating. */
 		graph->iter_node = NULL;
-		return NULL;
+		return got_error(GOT_ERR_ITER_COMPLETED);
 	}
 
 	if (TAILQ_NEXT(graph->iter_node, entry) == NULL)