rust-revlog: don't try to open the data file if the index is empty
This will cover the case where the data file is not present.
--- a/rust/hg-core/src/revlog/mod.rs Wed Jun 19 12:25:12 2024 +0200
+++ b/rust/hg-core/src/revlog/mod.rs Tue Sep 17 10:18:32 2024 +0200
@@ -712,6 +712,9 @@
let data_bytes: Option<Box<dyn Deref<Target = [u8]> + Send>> =
if index.is_inline() {
None
+ } else if index.is_empty() {
+ // No need to even try to open the data file then.
+ Some(Box::new(&[][..]))
} else {
let data_path = data_path.unwrap_or(&default_data_path);
let data_mmap = store_vfs.mmap_open(data_path)?;