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

Function open_commit_graph_chain

commit-graph.c:616–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614}
615
616int open_commit_graph_chain(const char *chain_file,
617 int *fd, struct stat *st,
618 const struct git_hash_algo *hash_algo)
619{
620 *fd = git_open(chain_file);
621 if (*fd < 0)
622 return 0;
623 if (fstat(*fd, st)) {
624 close(*fd);
625 return 0;
626 }
627 if (st->st_size < hash_algo->hexsz) {
628 close(*fd);
629 if (!st->st_size) {
630 /* treat empty files the same as missing */
631 errno = ENOENT;
632 } else {
633 warning(_("commit-graph chain file too small"));
634 errno = EINVAL;
635 }
636 return 0;
637 }
638 return 1;
639}
640
641struct commit_graph *load_commit_graph_chain_fd_st(struct object_database *odb,
642 int fd, struct stat *st,

Callers 2

load_commit_graph_chainFunction · 0.85
graph_verifyFunction · 0.85

Calls 1

warningFunction · 0.85

Tested by

no test coverage detected