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

Function add_loose_object

builtin/pack-objects.c:4528–4557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4526}
4527
4528static int add_loose_object(const struct object_id *oid, const char *path,
4529 void *data)
4530{
4531 struct rev_info *revs = data;
4532 enum object_type type = odb_read_object_info(the_repository->objects, oid, NULL);
4533
4534 if (type < 0) {
4535 warning(_("loose object at %s could not be examined"), path);
4536 return 0;
4537 }
4538
4539 if (cruft) {
4540 struct stat st;
4541 if (stat(path, &st) < 0) {
4542 if (errno == ENOENT)
4543 return 0;
4544 return error_errno("unable to stat %s", oid_to_hex(oid));
4545 }
4546
4547 add_cruft_object_entry(oid, type, NULL, 0, NULL,
4548 st.st_mtime);
4549 } else {
4550 add_object_entry(oid, type, "", 0);
4551 }
4552
4553 if (revs && type == OBJ_COMMIT)
4554 add_pending_oid(revs, NULL, oid, 0);
4555
4556 return 0;
4557}
4558
4559/*
4560 * We actually don't even have to worry about reachability here.

Callers

nothing calls this directly

Calls 8

odb_read_object_infoFunction · 0.85
warningFunction · 0.85
error_errnoFunction · 0.85
oid_to_hexFunction · 0.85
add_cruft_object_entryFunction · 0.85
add_object_entryFunction · 0.85
add_pending_oidFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected