Mercurial > hg
diff rust/hg-core/src/dirstate_tree/status.rs @ 49365:79b2c98ab7b4
branching: merge stable into default
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Thu, 16 Jun 2022 15:20:48 +0200 |
parents | c4ccd0346f5c 6cd249556e20 |
children | 7e5377bdb66e |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/status.rs Sat Jun 11 00:26:25 2022 +0200 +++ b/rust/hg-core/src/dirstate_tree/status.rs Thu Jun 16 15:20:48 2022 +0200 @@ -4,6 +4,7 @@ use crate::dirstate_tree::dirstate_map::BorrowedPath; use crate::dirstate_tree::dirstate_map::ChildNodesRef; use crate::dirstate_tree::dirstate_map::DirstateMap; +use crate::dirstate_tree::dirstate_map::DirstateVersion; use crate::dirstate_tree::dirstate_map::NodeRef; use crate::dirstate_tree::on_disk::DirstateV2ParseError; use crate::matchers::get_ignore_function; @@ -59,16 +60,29 @@ let (ignore_fn, warnings, patterns_changed): (IgnoreFnType, _, _) = if options.list_ignored || options.list_unknown { - let mut hasher = Sha1::new(); - let (ignore_fn, warnings) = get_ignore_function( - ignore_files, - &root_dir, - &mut |pattern_bytes| hasher.update(pattern_bytes), - )?; - let new_hash = *hasher.finalize().as_ref(); - let changed = new_hash != dmap.ignore_patterns_hash; - dmap.ignore_patterns_hash = new_hash; - (ignore_fn, warnings, Some(changed)) + let (ignore_fn, warnings, changed) = match dmap.dirstate_version { + DirstateVersion::V1 => { + let (ignore_fn, warnings) = get_ignore_function( + ignore_files, + &root_dir, + &mut |_pattern_bytes| {}, + )?; + (ignore_fn, warnings, None) + } + DirstateVersion::V2 => { + let mut hasher = Sha1::new(); + let (ignore_fn, warnings) = get_ignore_function( + ignore_files, + &root_dir, + &mut |pattern_bytes| hasher.update(pattern_bytes), + )?; + let new_hash = *hasher.finalize().as_ref(); + let changed = new_hash != dmap.ignore_patterns_hash; + dmap.ignore_patterns_hash = new_hash; + (ignore_fn, warnings, Some(changed)) + } + }; + (ignore_fn, warnings, changed) } else { (Box::new(|&_| true), vec![], None) }; @@ -133,7 +147,8 @@ outcome.dirty = common.ignore_patterns_have_changed == Some(true) || !outdated.is_empty() - || !new_cachable.is_empty(); + || (!new_cachable.is_empty() + && dmap.dirstate_version == DirstateVersion::V2); // Remove outdated mtimes before adding new mtimes, in case a given // directory is both