| 2186 | } |
| 2187 | |
| 2188 | int packfile_store_read_object_info(struct packfile_store *store, |
| 2189 | const struct object_id *oid, |
| 2190 | struct object_info *oi, |
| 2191 | enum object_info_flags flags) |
| 2192 | { |
| 2193 | struct pack_entry e; |
| 2194 | int ret; |
| 2195 | |
| 2196 | /* |
| 2197 | * In case the first read didn't surface the object, we have to reload |
| 2198 | * packfiles. This may cause us to discover new packfiles that have |
| 2199 | * been added since the last time we have prepared the packfile store. |
| 2200 | */ |
| 2201 | if (flags & OBJECT_INFO_SECOND_READ) |
| 2202 | packfile_store_reprepare(store); |
| 2203 | |
| 2204 | if (!find_pack_entry(store, oid, &e)) |
| 2205 | return 1; |
| 2206 | |
| 2207 | /* |
| 2208 | * We know that the caller doesn't actually need the |
| 2209 | * information below, so return early. |
| 2210 | */ |
| 2211 | if (!oi) |
| 2212 | return 0; |
| 2213 | |
| 2214 | ret = packed_object_info(e.p, e.offset, oi); |
| 2215 | if (ret < 0) { |
| 2216 | mark_bad_packed_object(e.p, oid); |
| 2217 | return -1; |
| 2218 | } |
| 2219 | |
| 2220 | return 0; |
| 2221 | } |
| 2222 | |
| 2223 | static void maybe_invalidate_kept_pack_cache(struct packfile_store *store, |
| 2224 | unsigned flags) |
no test coverage detected