Mercurial > hg
changeset 49045:a85c123c625a
rust-dirstate: don't return a state for untracked entries
This `state` API is a remnant of the former API and is slated for removal at
some point. Any caller of this function will expect an entry that is tracked
in the larger sense.
Differential Revision: https://phab.mercurial-scm.org/D12448
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 28 Mar 2022 18:53:55 +0200 |
parents | be9bf75a837c |
children | 1d6c6ad645e1 |
files | rust/hg-core/src/dirstate_tree/dirstate_map.rs |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Tue Mar 22 16:33:18 2022 +0100 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Mon Mar 28 18:53:55 2022 +0200 @@ -343,7 +343,13 @@ pub(super) fn state( &self, ) -> Result<Option<EntryState>, DirstateV2ParseError> { - Ok(self.entry()?.map(|e| e.state())) + Ok(self.entry()?.and_then(|e| { + if e.any_tracked() { + Some(e.state()) + } else { + None + } + })) } pub(super) fn cached_directory_mtime(