--- a/rust/hg-core/src/dirstate_tree/on_disk.rs Fri Oct 15 16:12:00 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs Fri Oct 15 16:33:19 2021 +0200
@@ -111,6 +111,8 @@
const MODE_EXEC_PERM = 1 << 6;
const MODE_IS_SYMLINK = 1 << 7;
const EXPECTED_STATE_IS_MODIFIED = 1 << 8;
+ const ALL_UNKNOWN_RECORDED = 1 << 9;
+ const ALL_IGNORED_RECORDED = 1 << 10;
}
}
@@ -322,7 +324,11 @@
pub(super) fn cached_directory_mtime(
&self,
) -> Result<Option<TruncatedTimestamp>, DirstateV2ParseError> {
- if self.flags().contains(Flags::HAS_DIRECTORY_MTIME) {
+ // For now we do not have code to handle ALL_UNKNOWN_RECORDED, so we
+ // ignore the mtime if the flag is set.
+ if self.flags().contains(Flags::HAS_DIRECTORY_MTIME)
+ && self.flags().contains(Flags::ALL_UNKNOWN_RECORDED)
+ {
if self.flags().contains(Flags::HAS_FILE_MTIME) {
Err(DirstateV2ParseError)
} else {
@@ -589,7 +595,18 @@
Node::from_dirstate_entry(entry)
}
dirstate_map::NodeData::CachedDirectory { mtime } => (
- Flags::HAS_DIRECTORY_MTIME,
+ // we currently never set a mtime if unknown file
+ // are present.
+ // So if we have a mtime for a directory, we know
+ // they are no unknown
+ // files and we
+ // blindly set ALL_UNKNOWN_RECORDED.
+ //
+ // We never set ALL_IGNORED_RECORDED since we
+ // don't track that case
+ // currently.
+ Flags::HAS_DIRECTORY_MTIME
+ | Flags::ALL_UNKNOWN_RECORDED,
0.into(),
(*mtime).into(),
),