Mercurial > hg
diff rust/hg-core/src/dirstate_tree/on_disk.rs @ 49337:6cd249556e20 stable
rust-status: don't trigger dirstate v1 rewrite when only v2 data is changed
The assumption that we need to rewrite (or append to) the dirstate if the
ignore pattern hash has changed or if any cached directory mtimes have changed
is only valid when using dirstate-v2. In dirstate-v1, neither of these things
are written to disk.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Wed, 08 Jun 2022 19:15:58 +0200 |
parents | 09984dc70352 |
children | 79b2c98ab7b4 |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs Tue Jun 14 04:04:08 2022 +0200 +++ b/rust/hg-core/src/dirstate_tree/on_disk.rs Wed Jun 08 19:15:58 2022 +0200 @@ -3,6 +3,7 @@ //! See `mercurial/helptext/internals/dirstate-v2.txt` use crate::dirstate::TruncatedTimestamp; +use crate::dirstate_tree::dirstate_map::DirstateVersion; use crate::dirstate_tree::dirstate_map::{self, DirstateMap, NodeRef}; use crate::dirstate_tree::path_with_basename::WithBasename; use crate::errors::HgError; @@ -276,7 +277,9 @@ metadata: &[u8], ) -> Result<DirstateMap<'on_disk>, DirstateV2ParseError> { if on_disk.is_empty() { - return Ok(DirstateMap::empty(on_disk)); + let mut map = DirstateMap::empty(on_disk); + map.dirstate_version = DirstateVersion::V2; + return Ok(map); } let (meta, _) = TreeMetadata::from_bytes(metadata) .map_err(|_| DirstateV2ParseError)?; @@ -291,6 +294,7 @@ ignore_patterns_hash: meta.ignore_patterns_hash, unreachable_bytes: meta.unreachable_bytes.get(), old_data_size: on_disk.len(), + dirstate_version: DirstateVersion::V2, }; Ok(dirstate_map) }