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

Function copy_oids_to_commits

commit-graph.c:2028–2065  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2026}
2027
2028static void copy_oids_to_commits(struct write_commit_graph_context *ctx)
2029{
2030 uint32_t i;
2031 enum commit_graph_split_flags flags = ctx->opts ?
2032 ctx->opts->split_flags : COMMIT_GRAPH_SPLIT_UNSPECIFIED;
2033
2034 ctx->num_extra_edges = 0;
2035 if (ctx->report_progress)
2036 ctx->progress = start_delayed_progress(
2037 ctx->r,
2038 _("Finding extra edges in commit graph"),
2039 ctx->oids.nr);
2040 oid_array_sort(&ctx->oids);
2041 for (i = 0; i < ctx->oids.nr; i = oid_array_next_unique(&ctx->oids, i)) {
2042 unsigned int num_parents;
2043 struct commit *commit;
2044
2045 display_progress(ctx->progress, i + 1);
2046
2047 commit = lookup_commit(ctx->r, &ctx->oids.oid[i]);
2048
2049 if (ctx->split && flags != COMMIT_GRAPH_SPLIT_REPLACE &&
2050 commit_graph_position(commit) != COMMIT_NOT_FROM_GRAPH)
2051 continue;
2052
2053 if (ctx->split && flags == COMMIT_GRAPH_SPLIT_REPLACE)
2054 repo_parse_commit(ctx->r, commit);
2055 else
2056 repo_parse_commit_no_graph(ctx->r, commit);
2057
2058 num_parents = commit_list_count(commit->parents);
2059 if (num_parents > 2)
2060 ctx->num_extra_edges += num_parents - 1;
2061
2062 commit_stack_push(&ctx->commits, commit);
2063 }
2064 stop_progress(&ctx->progress);
2065}
2066
2067static int write_graph_chunk_base_1(struct hashfile *f,
2068 struct commit_graph *g)

Callers 1

write_commit_graphFunction · 0.85

Calls 11

start_delayed_progressFunction · 0.85
oid_array_sortFunction · 0.85
oid_array_next_uniqueFunction · 0.85
display_progressFunction · 0.85
lookup_commitFunction · 0.85
commit_graph_positionFunction · 0.85
repo_parse_commitFunction · 0.85
commit_list_countFunction · 0.85
commit_stack_pushFunction · 0.85
stop_progressFunction · 0.85

Tested by

no test coverage detected