| 4526 | } |
| 4527 | |
| 4528 | static 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. |
nothing calls this directly
no test coverage detected