Commit ce47a424491a18ce7fec45cd7b3ab08f568c90d6

Stefan Sperling 2018-07-22T13:52:36

treat double-linking to same child in commit graph as no-op

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/lib/commit_graph.c b/lib/commit_graph.c
index e973de6..2c10f94 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -307,10 +307,10 @@ add_node(struct got_commit_graph_node **new_node,
 		if (got_object_id_cmp(commit_id, &child_node->id) == 0)
 			return got_error(GOT_ERR_BAD_OBJ_ID);
 
-		/* Prevent double-linking to the same child. */
+		/* Prevent double-linking to the same child (treat as no-op). */
 		SIMPLEQ_FOREACH(cid, &node->child_ids, entry) {
 			if (got_object_id_cmp(cid->id, &child_node->id) == 0)
-				return got_error(GOT_ERR_BAD_OBJ_ID);
+				return NULL;
 		}
 
 		err = add_vertex(&node->child_ids, &child_node->id);