remove some unused cruft from 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
diff --git a/lib/commit_graph.c b/lib/commit_graph.c
index 281577b..05b5588 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -38,15 +38,6 @@
struct got_commit_graph_node {
struct got_object_id id;
-
- /*
- * Each graph node corresponds to a commit object.
- * Graph vertices are modelled with an adjacency list.
- * Adjacencies of a graph node are parent (older) commits.
- */
- int nparents;
- struct got_object_id_queue parent_ids;
-
time_t commit_timestamp;
/* Used during graph iteration. */
@@ -138,32 +129,6 @@ alloc_graph(const char *path)
return graph;
}
-#if 0
-static int
-is_head_node(struct got_commit_graph_node *node)
-{
- return node->nchildren == 0;
-}
-
-int
-is_branch_point(struct got_commit_graph_node *node)
-{
- return node->nchildren > 1;
-}
-
-static int
-is_root_node(struct got_commit_graph_node *node)
-{
- return node->nparents == 0;
-}
-#endif
-
-static int
-is_merge_point(struct got_commit_graph_node *node)
-{
- return node->nparents > 1;
-}
-
static const struct got_error *
detect_changed_path(int *changed, struct got_commit_object *commit,
struct got_object_id *commit_id, const char *path,
@@ -245,20 +210,6 @@ add_node_to_iter_list(struct got_commit_graph *graph,
}
static const struct got_error *
-add_vertex(struct got_object_id_queue *ids, struct got_object_id *id)
-{
- const struct got_error *err = NULL;
- struct got_object_qid *qid;
-
- err = got_object_qid_alloc(&qid, id);
- if (err)
- return err;
-
- SIMPLEQ_INSERT_TAIL(ids, qid, entry);
- return NULL;
-}
-
-static const struct got_error *
close_branch(struct got_commit_graph *graph, struct got_object_id *commit_id)
{
const struct got_error *err;
@@ -295,7 +246,7 @@ advance_branch(struct got_commit_graph *graph,
* If we are graphing commits for a specific path, skip branches
* which do not contribute any content to this path.
*/
- if (is_merge_point(node) && !got_path_is_root_dir(graph->path)) {
+ if (commit->nparents > 1 && !got_path_is_root_dir(graph->path)) {
struct got_object_id *merged_id, *prev_id = NULL;
int branches_differ = 0;
@@ -380,17 +331,6 @@ advance_branch(struct got_commit_graph *graph,
return NULL;
}
-static void
-free_node(struct got_commit_graph_node *node)
-{
- while (!SIMPLEQ_EMPTY(&node->parent_ids)) {
- struct got_object_qid *pid = SIMPLEQ_FIRST(&node->parent_ids);
- SIMPLEQ_REMOVE_HEAD(&node->parent_ids, entry);
- got_object_qid_free(pid);
- }
- free(node);
-}
-
static const struct got_error *
add_node(struct got_commit_graph_node **new_node, int *changed,
int *branch_done, struct got_commit_graph *graph,
@@ -399,7 +339,6 @@ add_node(struct got_commit_graph_node **new_node, int *changed,
{
const struct got_error *err = NULL;
struct got_commit_graph_node *node;
- struct got_object_qid *pid;
*new_node = NULL;
*changed = 0;
@@ -410,20 +349,11 @@ add_node(struct got_commit_graph_node **new_node, int *changed,
return got_error_from_errno();
memcpy(&node->id, commit_id, sizeof(node->id));
- SIMPLEQ_INIT(&node->parent_ids);
- SIMPLEQ_FOREACH(pid, &commit->parent_ids, entry) {
- err = add_vertex(&node->parent_ids, pid->id);
- if (err) {
- free_node(node);
- return err;
- }
- node->nparents++;
- }
node->commit_timestamp = commit->committer_time;
err = got_object_idset_add(graph->node_ids, &node->id, node);
if (err) {
- free_node(node);
+ free(node);
return err;
}
@@ -440,7 +370,7 @@ add_node(struct got_commit_graph_node **new_node, int *changed,
} else {
got_object_idset_remove(NULL, graph->node_ids,
&node->id);
- free_node(node);
+ free(node);
return err;
}
}
@@ -626,7 +556,7 @@ static const struct got_error *
free_node_iter(struct got_object_id *id, void *data, void *arg)
{
struct got_commit_graph_node *node = data;
- free_node(node);
+ free(node);
return NULL;
}