| 2098 | } |
| 2099 | |
| 2100 | int is_pack_valid(struct packed_git *p) |
| 2101 | { |
| 2102 | /* An already open pack is known to be valid. */ |
| 2103 | if (p->pack_fd != -1) |
| 2104 | return 1; |
| 2105 | |
| 2106 | /* If the pack has one window completely covering the |
| 2107 | * file size, the pack is known to be valid even if |
| 2108 | * the descriptor is not currently open. |
| 2109 | */ |
| 2110 | if (p->windows) { |
| 2111 | struct pack_window *w = p->windows; |
| 2112 | |
| 2113 | if (!w->offset && w->len == p->pack_size) |
| 2114 | return 1; |
| 2115 | } |
| 2116 | |
| 2117 | /* Force the pack to open to prove its valid. */ |
| 2118 | return !open_packed_git(p); |
| 2119 | } |
| 2120 | |
| 2121 | static int fill_pack_entry(const struct object_id *oid, |
| 2122 | struct pack_entry *e, |
no test coverage detected