Commit ab471c4
committed
Download commit pack even when commit exists as loose object
When TryDownloadCommit finds the commit via CommitAndRootTreeExists,
it now checks whether the commit is a loose object. Loose commits
(e.g., from a prior 'git show' or 'git log' in a mounted enlistment)
do not include reachable trees. Skipping the download in this case
causes 'git checkout -f' to fail with 'unable to read tree', followed
by an expensive fallback that re-downloads and retries checkout.
If the commit is in a pack file (prefetch or commit pack), trees are
included by the GVFS protocol, so the download can safely be skipped.
Added GitRepo.LooseObjectExists() to check whether a SHA exists as a
loose object file in the shared cache or local object store.
Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>1 parent b65af3a commit ab471c4
2 files changed
Lines changed: 51 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
104 | 133 | | |
105 | 134 | | |
106 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | | - | |
| 490 | + | |
491 | 491 | | |
492 | | - | |
| 492 | + | |
493 | 493 | | |
494 | | - | |
495 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
496 | 508 | | |
497 | 509 | | |
498 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
499 | 517 | | |
500 | 518 | | |
501 | 519 | | |
| |||
0 commit comments