diff --git a/src/blob/tree.rs b/src/blob/tree.rs index 87719bf..0c4d00e 100644 --- a/src/blob/tree.rs +++ b/src/blob/tree.rs @@ -40,7 +40,7 @@ impl Tree { pub async fn from_backend(be: &impl IndexedBackend, id: Id) -> Result { let data = be .get_tree(&id) - .ok_or_else(|| anyhow!("blob not found in index"))? + .ok_or_else(|| anyhow!("blob {} not found in index", id.to_hex()))? .read_data(be.be()) .await?; diff --git a/src/commands/check.rs b/src/commands/check.rs index cda4f2a..f7a424f 100644 --- a/src/commands/check.rs +++ b/src/commands/check.rs @@ -42,11 +42,20 @@ async fn check_packs(be: &impl DecryptReadBackend) -> Result { let mut process_pack = |p: IndexPack| { packs.insert(p.id, p.pack_size()); + let blob_type = p.blob_type(); + // check offsests in index let mut expected_offset: u32 = 0; let mut blobs = p.blobs; blobs.sort_unstable(); for blob in blobs { + if blob.tpe != blob_type { + eprintln!( + "pack {}: blob {} blob type does not match: {:?}, expected: {:?}", + p.id, blob.id, blob.tpe, blob_type + ); + } + if blob.offset != expected_offset { eprintln!( "pack {}: blob {} offset in index: {}, expected: {}", diff --git a/src/index/binarysorted.rs b/src/index/binarysorted.rs index f297d3e..f331b74 100644 --- a/src/index/binarysorted.rs +++ b/src/index/binarysorted.rs @@ -85,7 +85,7 @@ impl Extend for IndexCollector { length: blob.length, uncompressed_length: blob.uncompressed_length, }; - match (p.blob_type(), &mut self.data) { + match (blob.tpe, &mut self.data) { (BlobType::Tree, _) => self.tree.push(be), (BlobType::Data, SortedHashSetMap::None) => {} (BlobType::Data, SortedHashSetMap::Set(ids)) => ids.push(blob.id),