chokidar
chokidar copied to clipboard
macOS: renaming file to different case reports ADD, CHANGE
Describe the bug
Renaming a file to the same name with different casing reports as ADD and CHANGE, but not DELETE. This makes it impossible to detect this change as a rename operation.
Versions (please complete the following information):
- Chokidar version
3.3.1
- Node version
12.13.1
- OS version:
macOS 10.15
To Reproduce:
const chokidar = require('chokidar');
// One-liner for current directory
chokidar.watch('.').on('all', (event, path) => {
console.log(event, path);
});
- rename a file
Foo.txt
tofoo.txt
- the output is
change Foo.txt
add foo.txt
Expected behavior I would expect this:
delete Foo.txt
add foo.txt
I am experiencing a similar issue when changing the case of a folder name.
Doing so will emit addDir
twice.
This is probably related to https://github.com/paulmillr/chokidar/issues/927
Besides, the order in which the addDir
events are emitted doesn't seem to always be the same as the raw moved
events emitted for the same action.
We added some logic to treat two consecutive addDir
events for the same inode as a movement but if the events are received in the wrong order, we detect the wrong movement.
The original poster's bug is affecting me, too.