diff rust/hg-core/src/dirstate_tree/on_disk.rs @ 50245:dbe09fb038fc stable

rhg: remember the inode of .hg/dirstate This allows us to detect changes of `.hg/dirstate`, which is either the full dirstate (in dirstate-v1) or the docket file (v2) without relying on data inside the file. It only works on UNIX systems. This fixes a race condition for dirstate-v1 (as demonstrated by the test changes) and adds a confortable layer of sanity for dirstate-v2.
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 01 Mar 2023 16:48:09 +0100
parents 6cce0afc1454
children a6b8b1ab9116
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs	Tue Feb 28 17:58:15 2023 +0100
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs	Wed Mar 01 16:48:09 2023 +0100
@@ -291,6 +291,7 @@
     on_disk: &'on_disk [u8],
     metadata: &[u8],
     uuid: Vec<u8>,
+    identity: Option<u64>,
 ) -> Result<DirstateMap<'on_disk>, DirstateV2ParseError> {
     if on_disk.is_empty() {
         let mut map = DirstateMap::empty(on_disk);
@@ -314,6 +315,7 @@
         unreachable_bytes: meta.unreachable_bytes.get(),
         old_data_size: on_disk.len(),
         old_uuid: Some(uuid),
+        identity,
         dirstate_version: DirstateVersion::V2,
         write_mode: DirstateMapWriteMode::Auto,
     };