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

Function write_graph_chunk_extra_edges

commit-graph.c:1396–1449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1394}
1395
1396static int write_graph_chunk_extra_edges(struct hashfile *f,
1397 void *data)
1398{
1399 struct write_commit_graph_context *ctx = data;
1400 struct commit **list = ctx->commits.items;
1401 struct commit **last = ctx->commits.items + ctx->commits.nr;
1402 struct commit_list *parent;
1403
1404 while (list < last) {
1405 int num_parents = 0;
1406
1407 display_progress(ctx->progress, ++ctx->progress_cnt);
1408
1409 for (parent = (*list)->parents; num_parents < 3 && parent;
1410 parent = parent->next)
1411 num_parents++;
1412
1413 if (num_parents <= 2) {
1414 list++;
1415 continue;
1416 }
1417
1418 /* Since num_parents > 2, this initializer is safe. */
1419 for (parent = (*list)->parents->next; parent; parent = parent->next) {
1420 int edge_value = oid_pos(&parent->item->object.oid,
1421 ctx->commits.items,
1422 ctx->commits.nr,
1423 commit_to_oid);
1424
1425 if (edge_value >= 0)
1426 edge_value += ctx->new_num_commits_in_base;
1427 else if (ctx->new_base_graph) {
1428 uint32_t pos;
1429 if (find_commit_pos_in_graph(parent->item,
1430 ctx->new_base_graph,
1431 &pos))
1432 edge_value = pos;
1433 }
1434
1435 if (edge_value < 0)
1436 BUG("missing parent %s for commit %s",
1437 oid_to_hex(&parent->item->object.oid),
1438 oid_to_hex(&(*list)->object.oid));
1439 else if (!parent->next)
1440 edge_value |= GRAPH_LAST_EDGE;
1441
1442 hashwrite_be32(f, edge_value);
1443 }
1444
1445 list++;
1446 }
1447
1448 return 0;
1449}
1450
1451static int write_graph_chunk_bloom_indexes(struct hashfile *f,
1452 void *data)

Callers

nothing calls this directly

Calls 5

display_progressFunction · 0.85
oid_posFunction · 0.85
find_commit_pos_in_graphFunction · 0.85
oid_to_hexFunction · 0.85
hashwrite_be32Function · 0.85

Tested by

no test coverage detected