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

Bug: editing a file triggers all 3 events for same file #209

Closed
e2 opened this issue Apr 13, 2014 · 2 comments
Closed

Bug: editing a file triggers all 3 events for same file #209

e2 opened this issue Apr 13, 2014 · 2 comments

Comments

@e2
Copy link
Contributor

e2 commented Apr 13, 2014

How to reproduce:

  1. edit file in Vim
  2. the callback is called with e.g.:
:modified=>["foo", "4913"], :added=>["4913", "foo"], :removed=>["foo", "4913"]

It makes no sense to have the same file triggering all(!) 3 events within a single callback.

The events should either be:

  • "squashed" (so e.g. only "modified" is triggered)
  • only 2 callbacks in the correct order (removed, added)

It doesn't make sense to have the same file simultaneously as:

  • "removed" and "modified" (just "removed" or just "modified")
  • "added" and "removed" (just "removed" or just "added")
  • "modified" and "removed" (just "removed" or just "modified")
    etc...

Technically, this is obscuring the original information in a way where no client can piece things together (e.g. distinguish between a newly added file or modified-and-moved file) without keeping a complete shapshot of the filesystem between callbacks.

(I wanted to discuss this before even attempting a fix/pull request - in case there's stuff I don't know about)

@thibaudgg
Copy link
Member

I agree that's a problem we need to fix that. I think it comes from how Vim is handling file saving, each editor has its own way (I guess you're on Linux): https://github.com/guard/guard/wiki/Analysis-of-inotify-events-for-different-editors

In that precise case, having only "modified" would be great.

@e2
Copy link
Contributor Author

e2 commented Apr 17, 2014

Fixed in #212

@e2 e2 closed this as completed Apr 17, 2014
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