Commit 6e0c0f9a81a38c2f4b56459cec187556cf8e06ff

Stefan Sperling 2018-06-11T15:52:51

remove got_commit_graph_contains_object() Put equivalent functionality into fetch_commits_up_to() instead.

diff --git a/include/got_commit_graph.h b/include/got_commit_graph.h
index 66ff219..a480124 100644
--- a/include/got_commit_graph.h
+++ b/include/got_commit_graph.h
@@ -29,6 +29,3 @@ const struct got_error *got_commit_graph_iter_start(
     struct got_commit_graph *, struct got_object_id *);
 const struct got_error *got_commit_graph_iter_next(struct got_object_id **,
     struct got_commit_graph *);
-
-int got_commit_graph_contains_object(struct got_commit_graph *,
-    struct got_object_id *);
diff --git a/lib/commit_graph.c b/lib/commit_graph.c
index cebac9e..23f278f 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -402,6 +402,10 @@ got_commit_graph_fetch_commits_up_to(int *nfetched,
 	int ncommits, wanted_id_added = 0;
 
 	*nfetched = 0;
+
+	if (got_object_idset_get(graph->node_ids, wanted_id) != NULL)
+		return NULL;
+
 	while (!wanted_id_added) {
 		err = fetch_commits_from_open_branches(&ncommits,
 		    &wanted_id_added, graph, repo, wanted_id);
@@ -493,10 +497,3 @@ got_commit_graph_iter_next(struct got_object_id **id,
 	graph->iter_node = node;
 	return NULL;
 }
-
-int
-got_commit_graph_contains_object(struct got_commit_graph *graph,
-    struct got_object_id *id)
-{
-	return (got_object_idset_get(graph->node_ids, id) != NULL);
-}