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

Function load_commit_graph_chain_fd_st

commit-graph.c:641–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639}
640
641struct commit_graph *load_commit_graph_chain_fd_st(struct object_database *odb,
642 int fd, struct stat *st,
643 int *incomplete_chain)
644{
645 struct commit_graph *graph_chain = NULL;
646 struct strbuf line = STRBUF_INIT;
647 struct object_id *oids;
648 int i = 0, valid = 1, count;
649 FILE *fp = xfdopen(fd, "r");
650
651 count = st->st_size / (odb->repo->hash_algo->hexsz + 1);
652 CALLOC_ARRAY(oids, count);
653
654 odb_prepare_alternates(odb);
655
656 for (i = 0; i < count; i++) {
657 struct odb_source *source;
658
659 if (strbuf_getline_lf(&line, fp) == EOF)
660 break;
661
662 if (get_oid_hex_algop(line.buf, &oids[i], odb->repo->hash_algo)) {
663 warning(_("invalid commit-graph chain: line '%s' not a hash"),
664 line.buf);
665 valid = 0;
666 break;
667 }
668
669 valid = 0;
670 for (source = odb->sources; source; source = source->next) {
671 char *graph_name = get_split_graph_filename(source, line.buf);
672 struct commit_graph *g = load_commit_graph_one(source, graph_name);
673
674 free(graph_name);
675
676 if (g) {
677 if (add_graph_to_chain(g, graph_chain, oids, i)) {
678 graph_chain = g;
679 valid = 1;
680 } else {
681 free_commit_graph(g);
682 }
683
684 break;
685 }
686 }
687
688 if (!valid) {
689 warning(_("unable to find all commit-graph files"));
690 break;
691 }
692 }
693
694 validate_mixed_generation_chain(graph_chain);
695 validate_mixed_bloom_settings(graph_chain);
696
697 free(oids);
698 fclose(fp);

Callers 2

load_commit_graph_chainFunction · 0.85
graph_verifyFunction · 0.85

Calls 12

xfdopenFunction · 0.85
odb_prepare_alternatesFunction · 0.85
strbuf_getline_lfFunction · 0.85
get_oid_hex_algopFunction · 0.85
warningFunction · 0.85
get_split_graph_filenameFunction · 0.85
load_commit_graph_oneFunction · 0.85
add_graph_to_chainFunction · 0.85
free_commit_graphFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected