Do not track changed files listed in .gitignore
AlexB52 opened this issue · comments
When using sqlite in a project like Hanami. Following the guides break:
https://guides.hanamirb.org/introduction/getting-started/
If a file is changed when running retest 'bundle exec rake'
the tests will change the sqlite database file which will trigger a changed file event. The rake task is run again modifying the sqlite file which then triggers another spec run... Making it a infinite loop
We should not listen to changes applied on files listed in .gitignore. This should not happen with a database that is not stored as a file like a postgresql or mysql setup.
Instead of excluding files from .gitignore it seems easier (maybe slower) to include only the files git tracks using git ls-files
Maybe something like tis
files = `git ls-files`.gsub("\n", "|")
listener = Listen.to('.', only: files, relative: true) { |modified, added, removed| # ... }
Or send the git ignored patterns in the exclude option of Listen
Or maybe just add sqlite to the ignored patterns 😂
The bug also happens when using byebug
and updating the .byebug_history
file