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

Do not track changed files listed in .gitignore #14

Closed
AlexB52 opened this issue Oct 22, 2020 · 0 comments · Fixed by #18
Closed

Do not track changed files listed in .gitignore #14

AlexB52 opened this issue Oct 22, 2020 · 0 comments · Fixed by #18
Assignees
Labels
bug Something isn't working

Comments

@AlexB52
Copy link
Owner

AlexB52 commented Oct 22, 2020

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

@AlexB52 AlexB52 self-assigned this Oct 22, 2020
@AlexB52 AlexB52 added the bug Something isn't working label Oct 29, 2020
@AlexB52 AlexB52 mentioned this issue Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant