diff tests/test-hgignore.t @ 47409:0ef8231e413f

dirstate-v2: Store a hash of ignore patterns (.hgignore) Later, this help extend `read_dir` caching to directories that contain ignored files (but no unknown files). Such cache must be invalidated when ignore patterns change since a formerly-ignored file might become unknown. This helps the default configuration of `hg status` where unknown files must be listed, but ignored files are not. Differential Revision: https://phab.mercurial-scm.org/D10836
author Simon Sapin <simon.sapin@octobus.net>
date Wed, 02 Jun 2021 11:25:18 +0200
parents 6763913fa175
children f23eafb036af
line wrap: on
line diff
--- a/tests/test-hgignore.t	Mon Jun 07 17:29:32 2021 +0530
+++ b/tests/test-hgignore.t	Wed Jun 02 11:25:18 2021 +0200
@@ -402,3 +402,23 @@
   $ hg up -qC .
 
 #endif
+
+#if dirstate-v2
+
+Check the hash of ignore patterns written in the dirstate at offset
+12 + 20 + 20 + 8 + 4 + 4 + 4 = 72
+
+  $ hg status > /dev/null
+  $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1
+  sha1=6e315b60f15fb5dfa02be00f3e2c8f923051f5ff
+  >>> import binascii; print(binascii.hexlify(open(".hg/dirstate", "rb").read()[72:][:20]).decode())
+  6e315b60f15fb5dfa02be00f3e2c8f923051f5ff
+
+  $ echo rel > .hg/testhgignorerel
+  $ hg status > /dev/null
+  $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1
+  sha1=dea19cc7119213f24b6b582a4bae7b0cb063e34e
+  >>> import binascii; print(binascii.hexlify(open(".hg/dirstate", "rb").read()[72:][:20]).decode())
+  dea19cc7119213f24b6b582a4bae7b0cb063e34e
+
+#endif