Commit 6a4c18905deaa2e3c0663558d5016e475e5f64c6

Stefan Sperling 2018-06-11T14:23:42

introduce got_commit_graph_contains_object

diff --git a/include/got_commit_graph.h b/include/got_commit_graph.h
index f18494c..c97734f 100644
--- a/include/got_commit_graph.h
+++ b/include/got_commit_graph.h
@@ -27,3 +27,6 @@ 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 89f1d2c..50d6b35 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -466,3 +466,10 @@ 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);
+}