rhg: show a bug where repeated [hg status] is needed to cache everything stable
authorArseniy Alekseyev <aalekseyev@janestreet.com>
Thu, 22 Sep 2022 15:34:27 -0400
branchstable
changeset 49553 557f7e243ac9
parent 49552 1994842955db
child 49554 ecf9788cd9c4
rhg: show a bug where repeated [hg status] is needed to cache everything
tests/test-status.t
--- a/tests/test-status.t	Fri Nov 04 16:15:12 2022 -0400
+++ b/tests/test-status.t	Thu Sep 22 15:34:27 2022 -0400
@@ -944,7 +944,7 @@
   $ hg debugdirstate --all --no-dates | grep '^ '
       0         -1 unset               subdir
 
-Now the directory is eligible for caching, so its mtime is save in the dirstate
+Now the directory is eligible for caching, so its mtime is saved in the dirstate
 
   $ rm subdir/unknown
   $ sleep 0.1 # ensure the kernel’s internal clock for mtimes has ticked
@@ -976,4 +976,35 @@
   $ hg status
   ? subdir/a
 
+Changing the hgignore rules makes us recompute the status (and rewrite the dirstate).
+
+  $ rm subdir/a
+  $ mkdir another-subdir
+  $ touch another-subdir/something-else
+
+  $ cat > "$TESTDIR"/extra-hgignore <<EOF
+  > something-else
+  > EOF
+
+  $ hg status --config ui.ignore.global="$TESTDIR"/extra-hgignore
+  $ hg debugdirstate --all --no-dates | grep '^ '
+      0         -1 set                 subdir
+
+  $ hg status
+  ? another-subdir/something-else
+
+  $ hg debugdirstate --all --no-dates | grep '^ '
+      0         -1 unset               subdir (known-bad-output !)
+
+For some reason the first [status] is not enough to save the updated
+directory mtime into the cache. The second invocation does it.
+The first call only clears the directory cache by marking the directories
+as "outdated", which seems like a bug.
+
+  $ hg status
+  ? another-subdir/something-else
+
+  $ hg debugdirstate --all --no-dates | grep '^ '
+      0         -1 set                 subdir
+
 #endif