| 2119 | } |
| 2120 | |
| 2121 | static int fill_pack_entry(const struct object_id *oid, |
| 2122 | struct pack_entry *e, |
| 2123 | struct packed_git *p) |
| 2124 | { |
| 2125 | off_t offset; |
| 2126 | |
| 2127 | if (oidset_size(&p->bad_objects) && |
| 2128 | oidset_contains(&p->bad_objects, oid)) |
| 2129 | return 0; |
| 2130 | |
| 2131 | offset = find_pack_entry_one(oid, p); |
| 2132 | if (!offset) |
| 2133 | return 0; |
| 2134 | |
| 2135 | /* |
| 2136 | * We are about to tell the caller where they can locate the |
| 2137 | * requested object. We better make sure the packfile is |
| 2138 | * still here and can be accessed before supplying that |
| 2139 | * answer, as it may have been deleted since the index was |
| 2140 | * loaded! |
| 2141 | */ |
| 2142 | if (!is_pack_valid(p)) |
| 2143 | return 0; |
| 2144 | e->offset = offset; |
| 2145 | e->p = p; |
| 2146 | return 1; |
| 2147 | } |
| 2148 | |
| 2149 | static int find_pack_entry(struct packfile_store *store, |
| 2150 | const struct object_id *oid, |
no test coverage detected