* Should be used only while writing commit-graph as it compares * generation value of commits by directly accessing commit-slab. */
| 176 | * generation value of commits by directly accessing commit-slab. |
| 177 | */ |
| 178 | static int commit_gen_cmp(const void *va, const void *vb) |
| 179 | { |
| 180 | const struct commit *a = *(const struct commit **)va; |
| 181 | const struct commit *b = *(const struct commit **)vb; |
| 182 | |
| 183 | const timestamp_t generation_a = commit_graph_data_at(a)->generation; |
| 184 | const timestamp_t generation_b = commit_graph_data_at(b)->generation; |
| 185 | /* lower generation commits first */ |
| 186 | if (generation_a < generation_b) |
| 187 | return -1; |
| 188 | else if (generation_a > generation_b) |
| 189 | return 1; |
| 190 | |
| 191 | /* use date as a heuristic when generations are equal */ |
| 192 | if (a->date < b->date) |
| 193 | return -1; |
| 194 | else if (a->date > b->date) |
| 195 | return 1; |
| 196 | return 0; |
| 197 | } |
| 198 | |
| 199 | char *get_commit_graph_filename(struct odb_source *source) |
| 200 | { |
nothing calls this directly
no test coverage detected