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
--- 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(