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

Allow rebuilds also based on attribute changes #8

Closed
jalkanen opened this issue Feb 3, 2016 · 2 comments
Closed

Allow rebuilds also based on attribute changes #8

jalkanen opened this issue Feb 3, 2016 · 2 comments

Comments

@jalkanen
Copy link

jalkanen commented Feb 3, 2016

If you use Vagrant, you can use https://github.com/mhallin/vagrant-notify-forwarder will send notifications from the host to the guest. However, it sends all changes only as ATTRIB changes, as per mhallin/notify-forwarder#2. These are visible to fsnotify as "fsnotify.Chmod" changes.

However, rerun filters out the fsnotify.Chmod as a "non-interesting" changes, and therefore does not properly trigger a rebuild. While most Chmod changes aren't useful, having a config option that also listens to them would be useful for Vagrant users.

The following diff should illustrate what I mean, though it's obviously missing the config option.

diff --git a/watcher.go b/watcher.go
index 44c3db2..297d792 100644
--- a/watcher.go
+++ b/watcher.go
@@ -25,7 +25,7 @@ func (w *watcher) isEventImportant(ev fsnotify.Event) bool {
                return false
        }

-       importantEvent := ev.Op == fsnotify.Write || ev.Op == fsnotify.Rename || ev.Op == fsnotify.Remove
+       importantEvent := ev.Op == fsnotify.Write || ev.Op == fsnotify.Rename || ev.Op == fsnotify.Remove || ev.Op == fsnotify.Chmod
        if !importantEvent {
                return false
        }

@ivpusic
Copy link
Owner

ivpusic commented Feb 3, 2016

sounds reasonable. do you have a time to make pull request for this feature? So we will need to update config struct, and conditionally listen for ChMood, and write some test (https://github.com/ivpusic/rerun/blob/master/watcher_test.go) to check if this works.

@jalkanen
Copy link
Author

jalkanen commented Feb 3, 2016

There you go :-) See PR #9

@ivpusic ivpusic closed this as completed in f6a3781 Feb 3, 2016
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