changeset 49557:ca19335e86e5 stable

dirstate-v2: add test that shows a collision in ignore patterns hash This hash is used for optimizing dirstate `status`. We demonstrate that the hash is incorrectly ignoring the changes to the semantics of the ignore files just because the contents (but not their source) haven't changed. This is fixed in the next changeset.
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 02 Nov 2022 15:24:39 +0100
parents 9172bd49cedc
children 363923bd51cd
files tests/test-hgignore.t
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-hgignore.t	Thu Nov 03 12:08:02 2022 +0100
+++ b/tests/test-hgignore.t	Wed Nov 02 15:24:39 2022 +0100
@@ -433,5 +433,33 @@
   sha1=dea19cc7119213f24b6b582a4bae7b0cb063e34e
   $ hg debugstate --docket | grep ignore
   ignore pattern hash: dea19cc7119213f24b6b582a4bae7b0cb063e34e
+  $ cd ..
+
+Check that the hash depends on the source of the hgignore patterns
+(otherwise the context is lost and things like subinclude are cached improperly)
+
+  $ hg init ignore-collision
+  $ cd ignore-collision
+  $ echo > .hg/testhgignorerel
+
+  $ mkdir dir1/ dir1/subdir
+  $ touch dir1/subdir/f dir1/subdir/ignored1
+  $ echo 'ignored1' > dir1/.hgignore
+
+  $ mkdir dir2 dir2/subdir
+  $ touch dir2/subdir/f dir2/subdir/ignored2
+  $ echo 'ignored2' > dir2/.hgignore
+  $ echo 'subinclude:dir2/.hgignore' >> .hgignore
+  $ echo 'subinclude:dir1/.hgignore' >> .hgignore
+
+  $ hg commit -Aqm_
+
+  $ > dir1/.hgignore
+  $ echo 'ignored' > dir2/.hgignore
+  $ echo 'ignored1' >> dir2/.hgignore
+  $ hg status
+  M dir1/.hgignore
+  M dir2/.hgignore
+  ? dir1/subdir/ignored1 (missing-correct-output !)
 
 #endif