chokidar icon indicating copy to clipboard operation
chokidar copied to clipboard

macOS: renaming file to different case reports ADD, CHANGE

Open bpasero opened this issue 5 years ago • 2 comments

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 to foo.txt
  • the output is
change Foo.txt
add foo.txt

Expected behavior I would expect this:

delete Foo.txt
add foo.txt

bpasero avatar Feb 20 '20 06:02 bpasero

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.

taratatach avatar May 04 '20 15:05 taratatach

The original poster's bug is affecting me, too.

george-thomas-hill avatar Apr 03 '23 08:04 george-thomas-hill