Index load keeps the index when it refuses an empty listing; counters of unchanged tables are repaired too, never moved backwards

This commit is contained in:
2026-10-21 09:08:50 +02:00
parent 85ea0acc50
commit 177361acae
2 changed files with 11 additions and 4 deletions
+2 -1
View File
@@ -94,7 +94,6 @@ final class BlobIndex {
*/
public function load(bool $verify = false, ?callable $progress = null): void {
$hadIndex = $this->blobs !== [];
$this->blobs = [];
$cached = $verify ? [] : ($this->cache?->all($this->repositoryId) ?? []);
$present = [];
$this->downloaded = 0;
@@ -114,6 +113,8 @@ final class BlobIndex {
if ($present === [] && ($hadIndex || $cached !== [] || ($verify && ($this->cache?->all($this->repositoryId) ?? []) !== []))) {
throw new BackendException('The location listed no index files, while some are known: not trusting that listing');
}
// only now: an empty listing that was refused above leaves the index as it was
$this->blobs = [];
$this->loaded = $present;
// The rest is downloaded several at a time where the location allows it: on a large
// repository these are tens of thousands of small files. getMany() keeps their order, so