# HG changeset patch # User Raphaël Gomès # Date 2021-03-15 12:05:00 # Node ID 3c9ddb1986a9812507364a828877ce23bc17b535 # Parent c5912e35d06dc5d40769bb3b929fe93ba823b8aa rust-status: fix issue6456 for the Rust implementation also This implementation is being used by a few people now, so we need it fixed, even though a big rewrite will be coming quite soon. Differential Revision: https://phab.mercurial-scm.org/D10217 diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs --- a/rust/hg-core/src/dirstate/status.rs +++ b/rust/hg-core/src/dirstate/status.rs @@ -184,7 +184,13 @@ fn dispatch_found( || other_parent || copy_map.contains_key(filename.as_ref()) { - Dispatch::Modified + if metadata.is_symlink() && size_changed { + // issue6456: Size returned may be longer due to encryption + // on EXT-4 fscrypt. TODO maybe only do it on EXT4? + Dispatch::Unsure + } else { + Dispatch::Modified + } } else if mod_compare(mtime, st_mtime as i32) || st_mtime == options.last_normal_time { diff --git a/rust/hg-core/src/utils/files.rs b/rust/hg-core/src/utils/files.rs --- a/rust/hg-core/src/utils/files.rs +++ b/rust/hg-core/src/utils/files.rs @@ -199,6 +199,12 @@ impl HgMetadata { st_ctime: metadata.ctime(), } } + + pub fn is_symlink(&self) -> bool { + // This is way too manual, but `HgMetadata` will go away in the + // near-future dirstate rewrite anyway. + self.st_mode & 0170000 == 0120000 + } } /// Returns the canonical path of `name`, given `cwd` and `root`