Mercurial > hg
diff rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 47474:c657beacdf2e
dirstate-v2: Drop cached read_dir results after .hgignore changes
Soon we’ll want the status algorithm to be able to skip `std::fs::read_dir` in
more cases, notabling when listing unknown files but not ignored files.
When ignore patterns change (which we detect by their hash, added to the
dirstate-v2 format in a previous changeset), a formerly-ignored file could
become unknown without changing its parent directory’s modification time.
Therefore we remove any directory mtime from the dirstate, effictively
invalidating the existing caches.
Differential Revision: https://phab.mercurial-scm.org/D10907
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 04 Jun 2021 15:26:38 +0200 |
parents | 0ef8231e413f |
children | eb416759af7e |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Tue Jun 22 22:52:08 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Fri Jun 04 15:26:38 2021 +0200 @@ -495,6 +495,19 @@ } } + pub(super) fn get_or_insert<'tree, 'path>( + &'tree mut self, + path: &HgPath, + ) -> Result<&'tree mut Node<'on_disk>, DirstateV2ParseError> { + Self::get_or_insert_node( + self.on_disk, + &mut self.root, + path, + WithBasename::to_cow_owned, + |_| {}, + ) + } + pub(super) fn get_or_insert_node<'tree, 'path>( on_disk: &'on_disk [u8], root: &'tree mut ChildNodes<'on_disk>,