diff rust/hg-core/src/dirstate_tree/status.rs @ 49182:f3e8b0b0a8c2

rust-dirstatemap: add `clear_cached_mtime` helper method This will help remove the `get_or_insert` method, which is dangerous because it does not take the `DirstateMap` counters into account. Differential Revision: https://phab.mercurial-scm.org/D12525
author Rapha?l Gom?s <rgomes@octobus.net>
date Fri, 08 Apr 2022 16:03:39 +0200
parents dd6b67d5c256
children 464747faef14
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/status.rs	Tue Mar 29 18:21:40 2022 +0200
+++ b/rust/hg-core/src/dirstate_tree/status.rs	Fri Apr 08 16:03:39 2022 +0200
@@ -140,10 +140,7 @@
     // Remove outdated mtimes before adding new mtimes, in case a given
     // directory is both
     for path in &outdated {
-        let node = dmap.get_or_insert(path)?;
-        if let NodeData::CachedDirectory { .. } = &node.data {
-            node.data = NodeData::None
-        }
+        dmap.clear_cached_mtime(path)?;
     }
     for (path, mtime) in &new_cachable {
         let node = dmap.get_or_insert(path)?;