| 145 | } |
| 146 | |
| 147 | static struct commit_graph_data *commit_graph_data_at(const struct commit *c) |
| 148 | { |
| 149 | unsigned int i, nth_slab; |
| 150 | struct commit_graph_data *data = |
| 151 | commit_graph_data_slab_peek(&commit_graph_data_slab, c); |
| 152 | |
| 153 | if (data) |
| 154 | return data; |
| 155 | |
| 156 | nth_slab = c->index / commit_graph_data_slab.slab_size; |
| 157 | data = commit_graph_data_slab_at(&commit_graph_data_slab, c); |
| 158 | |
| 159 | /* |
| 160 | * commit-slab initializes elements with zero, overwrite this with |
| 161 | * COMMIT_NOT_FROM_GRAPH for graph_pos. |
| 162 | * |
| 163 | * We avoid initializing generation with checking if graph position |
| 164 | * is not COMMIT_NOT_FROM_GRAPH. |
| 165 | */ |
| 166 | for (i = 0; i < commit_graph_data_slab.slab_size; i++) { |
| 167 | commit_graph_data_slab.slab[nth_slab][i].graph_pos = |
| 168 | COMMIT_NOT_FROM_GRAPH; |
| 169 | } |
| 170 | |
| 171 | return data; |
| 172 | } |
| 173 | |
| 174 | /* |
| 175 | * Should be used only while writing commit-graph as it compares |
no outgoing calls
no test coverage detected