This is an archive of the discontinued Mercurial Phabricator instance.

dirstate-tree: Ignore FIFOs etc. in the status algorithm
ClosedPublic

Authored by SimonSapin on May 3 2021, 6:25 AM.

Details

Summary

If a filesystem directory contains anything that is not:

  • a "normal" file
  • a symbolic link
  • or a directory

… act as if that directory entry was not there. For example, if that path was
previously a tracked file, mark it as deleted or removed.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

SimonSapin created this revision.May 3 2021, 6:25 AM

If the non-file, non-symlink entry is exactly matched, it should be reported as a warning as a "bad" match

Yes, tests/test-symlinks.t covers this:

[…]
  $ mkfifo a.c
  $ hg status
  M dir/b.o
  ! a.c
  ! dir/a.o
  ? .hgignore
  $ hg status a.c
  a.c: unsupported file type (type is fifo)
  ! a.c

And it passes when I run it with --extra-config-opt experimental.dirstate-tree.in-memory=1. Maybe this is taken care of when constructing the matcher?

And it passes when I run it with --extra-config-opt experimental.dirstate-tree.in-memory=1. Maybe this is taken care of when constructing the matcher?

I find it weird because the only place I see bad being appended to is if DirEntry::read_dir returns an IoError, which should not happen in the test-case you're quoting. Or am I missing something?

baymax updated this revision to Diff 27624.May 6 2021, 12:03 PM

✅ refresh by Heptapod after a successful CI run (🐙 💚)

Alphare accepted this revision.May 6 2021, 12:14 PM

This most likely isn't going through Rust for this case. This can be handled in a follow-up changeset.

This revision is now accepted and ready to land.May 6 2021, 12:14 PM

Ah, I figured it out. The relevant command in the test creates a patternmatcher which is not in allowed_matchers, so dirstate.py falls back to Python status(), so the code in this patch does not end up being used.

… which is weird because I definitely remember this test failing with --extra-config-opt experimental.dirstate-tree.in-memory=1. Could the matcher type have changed between that and a rebase?

… which is weird because I definitely remember this test failing with --extra-config-opt experimental.dirstate-tree.in-memory=1. Could the matcher type have changed between that and a rebase?

I don't think so, I haven't seen anything that touched code around matches since you started this work.