Patchwork D11729: dirstate: make sure that status does not overlook the status flags

login
register
mail settings
Submitter phabricator
Date Oct. 28, 2021, 9:14 p.m.
Message ID <differential-rev-PHID-DREV-bm6glzu7tialdl2625ir-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50053/
State Superseded
Headers show

Comments

phabricator - Oct. 28, 2021, 9:14 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Without this extra checks, file with fallback flags change as the only change
  would be overlooked.
  
  In the future we might store proper data in the dirstate and do less lookup.
  However, for now this will do to make sure that 6.0 is forward compatible with
  later version.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py
  mercurial/helptext/internals/dirstate-v2.txt

CHANGE DETAILS




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

Patch

diff --git a/mercurial/helptext/internals/dirstate-v2.txt b/mercurial/helptext/internals/dirstate-v2.txt
--- a/mercurial/helptext/internals/dirstate-v2.txt
+++ b/mercurial/helptext/internals/dirstate-v2.txt
@@ -523,12 +523,18 @@ 
     this indicates whether the file’s own is expected
     to have execute permission.
 
+    Beware that on system without fs support for this information, the value
+    stored in the dirstate might be wrong and should not be relied on.
+
 `MODE_IS_SYMLINK`
     Must be unset if `HAS_MODE_AND_SIZE` is unset.
     If `HAS_MODE_AND_SIZE` is set,
     this indicates whether the file is expected to be a symlink
     as opposed to a normal file.
 
+    Beware that on system without fs support for this information, the value
+    stored in the dirstate might be wrong and should not be relied on.
+
 `EXPECTED_STATE_IS_MODIFIED`
     Must be unset for untracked nodes.
     For:
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1352,6 +1352,7 @@ 
         mexact = match.exact
         dirignore = self._dirignore
         checkexec = self._checkexec
+        checklink = self._checklink
         copymap = self._map.copymap
         lastnormaltime = self._lastnormaltime
 
@@ -1384,7 +1385,17 @@ 
             elif t.removed:
                 radd(fn)
             elif t.tracked:
-                if (
+                if not checklink and t.has_fallback_symlink:
+                    # If the file system does not support symlink, the mode
+                    # might not be correctly stored in the dirstate, so do not
+                    # trust it.
+                    ladd(fn)
+                elif not checkexec and t.has_fallback_exec:
+                    # If the file system does not support exec bits, the mode
+                    # might not be correctly stored in the dirstate, so do not
+                    # trust it.
+                    ladd(fn)
+                elif (
                     size >= 0
                     and (
                         (size != st.st_size and size != st.st_size & _rangemask)