MCPcopy Create free account
hub / github.com/git/git / open_multi_pack_index_chain

Function open_multi_pack_index_chain

midx.c:256–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256static int open_multi_pack_index_chain(const struct git_hash_algo *hash_algo,
257 const char *chain_file, int *fd,
258 struct stat *st)
259{
260 *fd = git_open(chain_file);
261 if (*fd < 0)
262 return 0;
263 if (fstat(*fd, st)) {
264 close(*fd);
265 return 0;
266 }
267 if (st->st_size < hash_algo->hexsz) {
268 close(*fd);
269 if (!st->st_size) {
270 /* treat empty files the same as missing */
271 errno = ENOENT;
272 } else {
273 warning(_("multi-pack-index chain file too small"));
274 errno = EINVAL;
275 }
276 return 0;
277 }
278 return 1;
279}
280
281static int add_midx_to_chain(struct multi_pack_index *midx,
282 struct multi_pack_index *midx_chain)

Callers 1

Calls 1

warningFunction · 0.85

Tested by

no test coverage detected