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

ignored fn needs to know if it is file or directory #51

Closed
vojtajina opened this issue Jul 21, 2013 · 4 comments · Fixed by #61
Closed

ignored fn needs to know if it is file or directory #51

vojtajina opened this issue Jul 21, 2013 · 4 comments · Fixed by #61

Comments

@vojtajina
Copy link
Contributor

Karma allows watching glob patterns (eg. src/**/*.js), which is done through watching directories. Eg src/**/*.js will watch entire src/ directory.

In order to be efficient, we want to ignore every file we can - that is simple, ignored function can just check if it matches the pattern and ignore otherwise.

However, we need to NOT ignore directories, as there can be a matching file in there.

Quick suggestions:

  • check ignored AFTER stating the fs (which means stating even ignored files) and pass it the stat obj
  • check ignored both BEFORE (as it does now) and AFTER stating; assuming the ignored fn is cheap, this could be better
@vojtajina
Copy link
Contributor Author

@paulmillr ideas ?

@vojtajina
Copy link
Contributor Author

@paulmillr sorry to bother, this would allow Karma to be much more efficient. Should I send you a PR with one of the solutions ? If so, which one do you prefer ? Or do you have any better ideas ? Thanks.

@paulmillr
Copy link
Owner

checking after does not sound like efficient solution. checking before and after sounds alright, but i will rather see the implementation because i don't get much what is this about in terms of code

vojtajina added a commit to vojtajina/chokidar that referenced this issue Oct 18, 2013
When deciding if an item should be ignored, it is helpful to know whether it is a file or a directory. Delaying the check after we have the stats information would mean unnecessary stat calls for those items that can be ignored based on the path.

This is a breaking change:
The `ignored` function will be called twice for each new item - once without the stats object, then again once we have the stats information.

Closes paulmillr#51
@vojtajina
Copy link
Contributor Author

@paulmillr here's the proposal
#61

vojtajina added a commit to vojtajina/chokidar that referenced this issue Oct 21, 2013
When deciding if an item should be ignored, it is helpful to know whether it is a file or a directory. Delaying the check after we have the stats information would mean unnecessary stat calls for those items that can be ignored based on the path.

If `options.ignored` is a function with two arguments, it will be called twice for each new item - once without the stats object, then again once we have the stats information.

If `options.ignored` is a regular expression or a function with a single argument, it will be called once.

Closes paulmillr#51
vojtajina added a commit to vojtajina/chokidar that referenced this issue Oct 21, 2013
When deciding if an item should be ignored, it is helpful to know whether it is a file or a directory. Delaying the check after we have the stats information would mean unnecessary stat calls for those items that can be ignored based on the path.

If `options.ignored` is a function with two arguments, it will be called twice for each new item - once without the stats object, then again once we have the stats information.

If `options.ignored` is a regular expression or a function with a single argument, it will be called once.

Closes paulmillr#51
taratatach pushed a commit to taratatach/chokidar that referenced this issue Oct 2, 2023
Fix var scoping on proxy function (fixes paulmillr#50)
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

Successfully merging a pull request may close this issue.

2 participants