Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs.watch() not detecting changes to file from git operation #126

Closed
tumblingG opened this issue Mar 2, 2023 · 3 comments
Closed

fs.watch() not detecting changes to file from git operation #126

tumblingG opened this issue Mar 2, 2023 · 3 comments

Comments

@tumblingG
Copy link

can we fix this problem?

nodejs/node#5039

@yuanchuan
Copy link
Owner

After some modifications to a local git repo, it outputs:

❯ ./watch .
update .git/.gitstatus.N0Qvnh
update .git/.gitstatus.N0Qvnh/a
update .git/.gitstatus.N0Qvnh/b
remove .git/.gitstatus.N0Qvnh/b/1
remove .git/.gitstatus.N0Qvnh/a/1
remove .git/.gitstatus.N0Qvnh/b
remove .git/.gitstatus.N0Qvnh/a
remove .git/.gitstatus.N0Qvnh
update s
remove s

So It works properly on my machine (macOS).

Could you please provide more infomation and a sample test code?

@tumblingG
Copy link
Author

tumblingG commented Mar 3, 2023

image

As shown in the figure above, when I switch branches, sometimes files and folders change together, sometimes only folders change. I tried to write a similar demo, but failed. My environment is window

@yuanchuan
Copy link
Owner

sometimes only folders change

This is an expected behavior of fs.watch when a folder is being deleted. We can't fix that unless the initial scan is implemented. Related issue: #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants