MCPcopy Index your code
hub / github.com/git/git / merge_commit_graph

Function merge_commit_graph

commit-graph.c:2370–2397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2368}
2369
2370static 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
2399static int commit_compare(const void *_a, const void *_b)
2400{

Callers 1

merge_commit_graphsFunction · 0.85

Calls 8

oid_to_hexFunction · 0.85
st_addFunction · 0.85
commit_stack_growFunction · 0.85
display_progressFunction · 0.85
load_oid_from_graphFunction · 0.85
commit_stack_pushFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected