Repository navigation
Commit 5591ca7
committed
cat-file: fall back to OID lookup when a pack disappears mid-stream
"git cat-file --batch-all-objects --unordered" reads each object from
the pack and offset the walk handed it, rather than looking it up
again. If a concurrent repack removes that pack in between,
packed_object_info() calls use_pack(), which cannot reopen the unlinked
pack and dies with "packfile ... cannot be accessed" -- even though the
object still lives in the pack repack just wrote.
Guard the read with is_pack_valid(): if the pack can no longer be
opened, clear the pointer so we fall back to a normal object-database
lookup, which finds the object in whatever pack now holds it.
is_pack_valid() opens and pins the pack's fd, so once it succeeds the
pack stays readable even if it is unlinked an instant later.
Assisted-by: Claude Opus 4.8
Signed-off-by: Elijah Newren <newren@gmail.com>1 parent 7d955bb commit 5591ca7
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
546 | 555 | | |
547 | 556 | | |
548 | 557 | | |
| |||
0 commit comments