Skip to content
This repository was archived by the owner on Jan 18, 2025. It is now read-only.

Ignore directories #68

Closed
myrrlyn opened this issue May 5, 2017 · 5 comments
Closed

Ignore directories #68

myrrlyn opened this issue May 5, 2017 · 5 comments

Comments

@myrrlyn
Copy link

myrrlyn commented May 5, 2017

This is more of a feature request than a pressing issue, but:

Would it be possible to set this to remove certain directories (particularly .git/) from the list of filesystem entities monitored to trigger re-execution of the watch command?

I've noticed that when I perform Git operations that don't affect the main working tree, like stage/unstage, this still causes filesystem events that trigger a re-execution despite the source files not having changed.

This is a fantastic tool and I absolutely love using it. Thanks so much for making it!

@passcod
Copy link
Member

passcod commented May 6, 2017

This should already be happening, for .git, .svn, .hg, the target/ folder. Make sure you're using the latest (should be 5.0.1), and if it still happens, can you provide a --debug log displaying the behaviour? As well as your platform information.

@myrrlyn
Copy link
Author

myrrlyn commented May 8, 2017

Lol I fired up --debug and it told me right away "we're ignoring .git/ and target/" and now I feel like a jackass.

I'm still getting the churn, though. I have observed this on Windows and Linux x64.

My next guess is that maybe because I'm using IntelliJ IDEA, maybe the .idea/ folder is causing it. So I ran with --ignore '.idea/' and it ran thrice immediately, then paused. I then clicked in my Git client (SourceTree), and watch ran for five or six times in a continuous cycle before pausing again.

I am seeing the following lines in the debug trace on Windows x64:

*** Ignoring "\\\\?\\C:\\Users\\path\\to\\project\\.git\\index.lock": matched ignore filter
*** Path updated: "\\\\?\\C:\\Users\\path\\to\\project\\.git"

which in my unqualified opinion suggests that .git/* files are being ignored but .git/ the directory might be getting its metadata updated and causing an event trigger?

I am seeing that it appropriately ignores target/ as expected, thank you for that.

Judging by the repeated 'ignoring ".git/index.lock"; path update ".git/"', I'd have to guess that whenever the .git/ directory item is touched, it fires a re-execution.

@myrrlyn
Copy link
Author

myrrlyn commented May 8, 2017

Passing -i ".\.git\" did not suffice to stop the repeated runs whenever .git/index.lock was updated.

@passcod
Copy link
Member

passcod commented May 8, 2017

Ugh! Ok, I'll experiment a bit around this. Thanks for the report and investigation!

@mattgreen
Copy link

mattgreen commented May 10, 2017

This is a simple fix that will make it into the next watchexec.

@passcod, here is the diff on my end: watchexec/watchexec@6ebb7bc

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

No branches or pull requests

3 participants