| 2368 | } |
| 2369 | |
| 2370 | static void merge_commit_graph(struct write_commit_graph_context *ctx, |
| 2371 | struct commit_graph *g) |
| 2372 | { |
| 2373 | uint32_t i; |
| 2374 | uint32_t offset = g->num_commits_in_base; |
| 2375 | |
| 2376 | if (unsigned_add_overflows(ctx->commits.nr, g->num_commits)) |
| 2377 | die(_("cannot merge graph %s, too many commits: %"PRIuMAX), |
| 2378 | oid_to_hex(&g->oid), |
| 2379 | (uintmax_t)st_add(ctx->commits.nr, g->num_commits)); |
| 2380 | |
| 2381 | commit_stack_grow(&ctx->commits, g->num_commits); |
| 2382 | |
| 2383 | for (i = 0; i < g->num_commits; i++) { |
| 2384 | struct object_id oid; |
| 2385 | struct commit *result; |
| 2386 | |
| 2387 | display_progress(ctx->progress, i + 1); |
| 2388 | |
| 2389 | load_oid_from_graph(g, i + offset, &oid); |
| 2390 | |
| 2391 | /* only add commits if they still exist in the repo */ |
| 2392 | result = lookup_commit_reference_gently(ctx->r, &oid, 1); |
| 2393 | |
| 2394 | if (result) |
| 2395 | commit_stack_push(&ctx->commits, result); |
| 2396 | } |
| 2397 | } |
| 2398 | |
| 2399 | static int commit_compare(const void *_a, const void *_b) |
| 2400 | { |
no test coverage detected