Patchwork D10217: rust-status: fix issue6456 for the Rust implementation also

login
register
mail settings
Submitter phabricator
Date March 15, 2021, 2:06 p.m.
Message ID <differential-rev-PHID-DREV-au66xeqhf2kufra3exlc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48532/
State Superseded
Headers show

Comments

phabricator - March 15, 2021, 2:06 p.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D10217

AFFECTED FILES
  rust/hg-core/src/dirstate/status.rs
  rust/hg-core/src/utils/files.rs

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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
@@ -191,6 +191,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`
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 @@ 
                 || 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
             {