diff mercurial/helptext/internals/dirstate-v2.txt @ 48195:4d5a13253d34

dirstate-v2: Replace the 32-bit `mode` field with two bits Previously we stored the entire value from `stat_result.st_mode`, like dirstate-v1 does. However only the executable permission and type of file (only symbolic links and normal files are supported) are relevant to Mecurial. So replace this field with two bits in the existing bitfield byte. For now the unused space is left as padding, as it will be used for something else soon. Differential Revision: https://phab.mercurial-scm.org/D11635
author Simon Sapin <simon.sapin@octobus.net>
date Tue, 12 Oct 2021 17:57:57 +0200
parents 320de901896a
children 308d9c245337
line wrap: on
line diff
--- a/mercurial/helptext/internals/dirstate-v2.txt	Mon Oct 11 18:37:21 2021 +0200
+++ b/mercurial/helptext/internals/dirstate-v2.txt	Tue Oct 12 17:57:57 2021 +0200
@@ -380,6 +380,9 @@
     P2_INFO = 1 << 2
     HAS_MODE_AND_SIZE = 1 << 3
     HAS_MTIME = 1 << 4
+    MODE_EXEC_PERM = 1 << 5
+    MODE_IS_SYMLINK = 1 << 7
+
 
   Other bits are unset. The meaning of these bits are:
 
@@ -414,14 +417,17 @@
   in order to optimize `hg status`
   by enabling it to skip `readdir` in more cases.
 
-  When a node is for a file tracked anywhere,
-  the rest of the node data is three fields:
+  When a node is for a file tracked anywhere:
+  - If `HAS_MODE_AND_SIZE` is set, the file is expected
+    to be a symbolic link or a normal file based on `MODE_IS_SYMLINK`.
+  - If `HAS_MODE_AND_SIZE` is set, the file’s owner is expected
+    to have execute permission or not based on `MODE_EXEC_PERM`.
+  - If `HAS_MODE_AND_SIZE` is unset,
+    the expected type of file and permission are unknown.
+  The rest of the node data is three fields:
 
   * Offset 31:
-    If `HAS_MODE_AND_SIZE` is unset, four zero bytes.
-    Otherwise, a 32-bit integer for the Unix mode (as in `stat_result.st_mode`)
-    expected for this file to be considered clean.
-    Only the `S_IXUSR` bit (owner has execute permission) is considered.
+    4 unused bytes, set to zero
 
   * Offset 35:
     If `HAS_MODE_AND_SIZE` is unset, four zero bytes.