rust-status: fix issue6456 for the Rust implementation also
authorRaphaël Gomès <rgomes@octobus.net>
Mon, 15 Mar 2021 13:05:00 +0100
changeset 46770 3c9ddb1986a9
parent 46769 c5912e35d06d
child 46771 7f6c002d7c0a
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
rust/hg-core/src/dirstate/status.rs
rust/hg-core/src/utils/files.rs
--- a/rust/hg-core/src/dirstate/status.rs	Tue Mar 16 00:07:12 2021 +0100
+++ b/rust/hg-core/src/dirstate/status.rs	Mon Mar 15 13:05:00 2021 +0100
@@ -184,7 +184,13 @@
                 || 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
             {
--- a/rust/hg-core/src/utils/files.rs	Tue Mar 16 00:07:12 2021 +0100
+++ b/rust/hg-core/src/utils/files.rs	Mon Mar 15 13:05:00 2021 +0100
@@ -199,6 +199,12 @@
             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`